OSDN Git Service

add: license publisher
[pettanr/pettanr.git] / app / models / comic_story.rb
index 9e2fd28..12213ba 100644 (file)
@@ -6,7 +6,6 @@ class ComicStory < Peta::Leaf
   
   validates :comic_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :story_id, :presence => true, :numericality => true, :existence => {:both => false}
-  validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
   def supply_default
@@ -16,8 +15,6 @@ class ComicStory < Peta::Leaf
   end
   
   def overwrite operators
-    return false unless operators.author
-    self.author_id = operators.author.id
   end
   
   def disp_t
@@ -32,11 +29,7 @@ class ComicStory < Peta::Leaf
     self.disp_t_by_text + ':' + self.story.title
   end
   
-  def self.public_list_order
-    'comic_stories.updated_at desc'
-  end
-  
-  def self.list_where
+  def self.public_list_where list
     'comics.visible > 0'
   end
   
@@ -48,33 +41,10 @@ class ComicStory < Peta::Leaf
     }
   end
   
-  def self.play_list_where cid
-    ['comic_stories.comic_id = ?', cid]
-  end
-  
-  def self.play_list scroll, author, offset = 0, limit = ScrollPanel.default_panel_size
-    ScrollPanel.where(self.play_list_where(scroll.id)).includes(ScrollPanel.list_opt).order('scroll_panels.t').offset(offset).limit(limit)
-  end
-  
-  def self.list_opt
-    {
-      :comic => {
-        :author => {}, 
-      }
-    }
-  end
-  
-  def self.list_json_opt
-    {:include => {
-      :comic => {
-        :author => {}, 
-      }
-    }}
-  end
-  
   def self.show_opt
     {:include => {
       :comic => {
+        :author => {}
       }
     }}
   end
@@ -84,25 +54,4 @@ class ComicStory < Peta::Leaf
     self.comic.own?(operators) and self.story.own?(operators)
   end
   
-  def store operators, old_t = nil
-    res = false
-    self.class.transaction do
-      case self.allow? operators
-      when true
-        self.rotate old_t
-      when false
-        raise ActiveRecord::Forbidden
-      else
-      end
-      res = self.save
-      raise ActiveRecord::Rollback unless res
-      res = self.class.validate_t(self.comic_id) 
-      unless res
-        self.errors.add :t, 'unserialized'
-        raise ActiveRecord::Rollback 
-      end
-    end
-    res
-  end
-  
 end