oldhaven/app/models/music/artist.rb

17 lines
485 B
Ruby
Raw Normal View History

2011-06-14 20:05:12 +04:00
class Artist < ActiveRecord::Base
2011-09-26 09:22:18 +04:00
has_many :albums, :conditions => ['has_pic = 1'], :order => 'year ASC', :dependent => :destroy
2011-09-21 00:30:42 +04:00
has_many :artist_links, :dependent => :destroy
2011-09-22 03:20:41 +04:00
has_many :artist_aliases, :dependent => :destroy
has_many :tracks, :through => :track_artists
2011-10-20 15:01:57 +04:00
after_initialize :prepare_description
def status_str
%w(loading ok fail)[self.status]
end
def prepare_description
2011-10-20 22:16:46 +04:00
self.desc.gsub! /[\[<].*?[\]>]/, '' unless self.desc.nil?
2011-10-20 15:01:57 +04:00
end
2011-06-14 20:05:12 +04:00
end