X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fmodels%2Fartist.rb;h=3fc4bc9c3405220bf49613e48202c6da602c3071;hb=674d4fb2e72c2e1653b13d026af884559fd9eb4e;hp=04a6edf6dafa61b9769f78e3d0b9aca58146bc4c;hpb=623fb328302e8daec437b33f9511cdb491cbc203;p=pettanr%2Fpettanr.git diff --git a/app/models/artist.rb b/app/models/artist.rb index 04a6edf6..3fc4bc9c 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -1,4 +1,5 @@ class Artist < Peta::Owner + load_manifest belongs_to :user has_many :original_pictures has_many :pictures @@ -8,46 +9,23 @@ class Artist < Peta::Owner validates :user_id, :numericality => true, :existence => {:both => false} validates :provider_id, :numericality => {:allow_nil => true} - def self.valid_encode_columns - super + ['name'] - end - - def self.visible_count_options - {:conditions => ['artists.author_id is not null']} - end - def supply_default self.name = 'no name' if self.name.blank? + self.user_id = nil end def self.find_by_author author Artist.find( :first, :conditions => ['author_id = ?', author.id]) end - def self.list_where + def self.index_list_where list 'artists.provider_id is null' end - def self.list_order - 'artists.created_at desc' - end - - def self.list_opt - {:user => {:author => {}} } - end - - def self.list_json_opt - {:include => {:user => {:author => {}}} } - end - def self.show_opt {:include => {:user => {:author => {}}} } end - def self.show_json_opt - {:include => {:user => {:author => {}}} } - end - def self.export(dt = nil) opt = {} cond = if dt