1 class Scroll < Peta::Binder
3 has_many :scroll_panels
6 validates :title, :presence => true, :length => {:maximum => 100}
7 validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
8 validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
11 self.visible = 0 if self.visible.blank?
15 def overwrite operators
16 return false unless operators.author
17 self.author_id = operators.author.id
21 def visible? operators
23 when nil # super return
32 def self.public_list_where
37 {:include => {:scroll_panels => {:panel => {}}, :author => {}}}