1
0
Fork 0

Structuring models directory

This commit is contained in:
magnolia-fan 2011-09-26 03:14:59 +04:00
parent c883b7586c
commit d142c516be
24 changed files with 18 additions and 8 deletions

View File

@ -0,0 +1,4 @@
class LocalBrainz::CachedRelease < ActiveRecord::Base
belongs_to :album, :class_name => 'Album'
has_many :local_brainz_cached_tracks, :class_name => 'LocalBrainz::CachedTrack', :dependent => :destroy
end

View File

@ -0,0 +1,3 @@
class LocalBrainz::CachedTrack < ActiveRecord::Base
belongs_to :local_brainz_cached_release, :class_name => 'LocalBrainz::CachedRelease'
end

View File

@ -1,4 +0,0 @@
class LocalBrainz::Release < ActiveRecord::Base
belongs_to :album, :class_name => 'Album'
has_many :local_brainz_tracks, :class_name => 'LocalBrainz::Track', :dependent => :destroy
end

View File

@ -1,3 +0,0 @@
class LocalBrainz::Track < ActiveRecord::Base
belongs_to :local_brainz_release, :class_name => 'LocalBrainz::Release'
end

View File

@ -16,7 +16,7 @@ module Beathaven
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras) config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**}')]
# Only load the plugins named here, in the order given (default is alphabetical). # Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named. # :all can be used as a placeholder for all plugins not explicitly named.

View File

@ -0,0 +1,10 @@
class RenameLocalBrainzTables < ActiveRecord::Migration
def self.up
rename_table :local_brainz_tracks, :local_brainz_cached_tracks
rename_table :local_brainz_releases, :local_brainz_cached_releases
end
def self.down
rename_table :local_brainz_cached_tracks, :local_brainz_tracks
rename_table :local_brainz_cached_releases, :local_brainz_releases
end
end