1 class Artist < Peta::Owner
4 has_many :original_pictures
6 has_many :resource_pictures
8 validates :name, :presence => true, :length => {:maximum => 30}
9 validates :user_id, :numericality => true, :existence => {:both => false}
10 validates :provider_id, :numericality => {:allow_nil => true}
13 self.name = 'no name' if self.name.blank?
17 def self.find_by_author author
18 Artist.where(author_id: author.id).first
21 def self.index_list_where list
22 'artists.provider_id is null'
26 {:include => {:user => {:author => {}}} }
29 def self.export(dt = nil)
30 artists = Artist.where('artists.provider = 0')
31 artists = artists.where(['artists.updated_at >= ?', dt]) if dt