Structuring models directory
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class Album < ActiveRecord::Base
|
||||
belongs_to :artist
|
||||
has_many :tracks, :order => 'bonus ASC, position ASC', :dependent => :destroy
|
||||
has_many :local_brainz_releases, :class_name => 'LocalBrainz::Release', :dependent => :destroy
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class AlbumFormat < ActiveRecord::Base
|
||||
belongs_to :album
|
||||
belongs_to :format
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class AlbumGenre < ActiveRecord::Base
|
||||
belongs_to :album
|
||||
belongs_to :genre
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class AlbumStyle < ActiveRecord::Base
|
||||
belongs_to :album
|
||||
belongs_to :style
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
class Artist < ActiveRecord::Base
|
||||
has_many :albums, :order => 'has_pic DESC, year ASC, id ASC', :dependent => :destroy
|
||||
has_many :artist_links, :dependent => :destroy
|
||||
has_many :artist_aliases, :dependent => :destroy
|
||||
has_many :tracks, :through => :track_artists
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class ArtistAlias < ActiveRecord::Base
|
||||
belongs_to :artist
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
class ArtistLink < ActiveRecord::Base
|
||||
belongs_to :artist
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class Genre < ActiveRecord::Base
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class ReleaseFormat < ActiveRecord::Base
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class Style < ActiveRecord::Base
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class Track < ActiveRecord::Base
|
||||
belongs_to :album
|
||||
has_many :artists, :through => :track_artists
|
||||
end
|
||||
@@ -0,0 +1,4 @@
|
||||
class TrackArtist < ActiveRecord::Base
|
||||
belongs_to :track
|
||||
belongs_to :artist
|
||||
end
|
||||
Reference in New Issue
Block a user