Structuring models directory
This commit is contained in:
parent
c883b7586c
commit
d142c516be
|
@ -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
|
|
@ -0,0 +1,3 @@
|
|||
class LocalBrainz::CachedTrack < ActiveRecord::Base
|
||||
belongs_to :local_brainz_cached_release, :class_name => 'LocalBrainz::CachedRelease'
|
||||
end
|
|
@ -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
|
|
@ -1,3 +0,0 @@
|
|||
class LocalBrainz::Track < ActiveRecord::Base
|
||||
belongs_to :local_brainz_release, :class_name => 'LocalBrainz::Release'
|
||||
end
|
|
@ -16,7 +16,7 @@ module Beathaven
|
|||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# 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).
|
||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue