Adding indexes

This commit is contained in:
magnolia-fan
2011-09-26 04:48:31 +04:00
parent f328c319ed
commit 26808f9b66
2 changed files with 95 additions and 2 deletions
-2
View File
@@ -1,12 +1,10 @@
class Album < ActiveRecord::Base
belongs_to :artist
has_many :tracks, :order => 'bonus ASC, position ASC', :dependent => :destroy
has_many :local_brainz_cached_releases, :class_name => 'LocalBrainz::CachedRelease', :dependent => :destroy
has_many :album_formats
has_many :release_formats, :through => :album_formats
default_scope where(:master => true)
scope :with_non_masters, where(:master => [true, false])
def self.with_format f
joins(:release_formats).where(:release_formats => { :hash => f.to_s })