validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
- @@valid_encode_columns += ['title', 'description']
- @@visible_count_options = {:conditions => 'visible > 0'}
- #@@filer = Pettanr::Cross::Filer.new self.item_name, cross
+ def self.valid_encode_columns
+ super + ['title', 'description']
+ end
+
+ def self.visible_count_options
+ {:conditions => 'visible > 0'}
+ end
def supply_default
self.visible = 0 if self.visible.blank?
end
- def overwrite au
- return false unless au
- self.author_id = au.id
+ def overwrite operators
+ return false unless operators.author
+ self.author_id = operators.author.id
end
def visible? operators
- super
+ return false unless super
self.visible > 0
end
'comics.updated_at desc'
end
- def self.mylist_where me
- ['comics.author_id = ?', me.id]
- end
-
- def self.mylist_order
- 'comics.updated_at desc'
- end
-
- def self.himlist_where anybody
- ['comics.author_id = ? and comics.visible > 0', anybody.id]
- end
-
- def self.himlist_order
- 'comics.updated_at desc'
- end
-
- def self.list_by_author_where author_id
- ['comics.author_id = ?', author_id]
- end
-
- def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
- self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('comics.updated_at desc').offset((page -1) * page_size).limit(page_size)
- end
-
def self.list_opt
{:stories => {}, :author => {} }
end