validates :title, :presence => true, :length => {:maximum => 100}
validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
+ validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
+
before_validation :valid_encode
def valid_encode
self.visible > 0
end
+ def scroll_panels_count
+ ScrollPanel.where(['scroll_panels.scroll_id = ?', self.id]).count
+ end
+
def self.default_page_size
25
end