2 class Comic < Peta::Binder
4 has_many :comic_stories
7 validates :title, :presence => true, :length => {:maximum => 100}
8 validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
9 validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
12 self.visible = 0 if self.visible.blank?
16 def overwrite operators
17 return false unless operators.author
18 self.author_id = operators.author.id
21 def visible? operators
23 when nil # super return
35 def self.public_list_where list
40 {:include => {:comic_stories => {:story => {}}, :author => {}}}