17 lines
485 B
Ruby
17 lines
485 B
Ruby
class Artist < ActiveRecord::Base
|
|
has_many :albums, :conditions => ['has_pic = 1'], :order => 'year ASC', :dependent => :destroy
|
|
has_many :artist_links, :dependent => :destroy
|
|
has_many :artist_aliases, :dependent => :destroy
|
|
has_many :tracks, :through => :track_artists
|
|
|
|
after_initialize :prepare_description
|
|
|
|
def status_str
|
|
%w(loading ok fail)[self.status]
|
|
end
|
|
|
|
def prepare_description
|
|
self.desc.gsub! /[\[<].*?[\]>]/, '' unless self.desc.nil?
|
|
end
|
|
end
|