class Scroll < Peta::Content
+ load_manifest
has_many :scroll_panels
belongs_to :author
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}
-
- def self.valid_encode_columns
- super + ['title']
- end
def supply_default
self.visible = 0 if self.visible.blank?
{:include => {:scroll_panels => {:include => {:panel => {}}}, :author => {}}}
end
- def tag_attributes column = nil, opt = {}
- {
- }
- end
-
def self.visible_count
Scroll.count 'visible > 0'
end