2011-06-14 16:05:12 +00:00
|
|
|
class Album < ActiveRecord::Base
|
2011-06-14 20:01:42 +00:00
|
|
|
belongs_to :artist
|
2011-09-26 05:10:23 +00:00
|
|
|
has_many :tracks, :conditions => ['length > 0'], :order => 'bonus ASC, position ASC', :dependent => :destroy
|
2011-09-26 00:05:46 +00:00
|
|
|
has_many :album_formats
|
|
|
|
has_many :release_formats, :through => :album_formats
|
|
|
|
|
|
|
|
default_scope where(:master => true)
|
|
|
|
|
|
|
|
def self.with_format f
|
|
|
|
joins(:release_formats).where(:release_formats => { :hash => f.to_s })
|
|
|
|
end
|
2011-06-14 16:05:12 +00:00
|
|
|
end
|