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
+5
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
class AlbumFormat < ActiveRecord::Base
belongs_to :album
belongs_to :format
end
+4
View File
@@ -0,0 +1,4 @@
class AlbumGenre < ActiveRecord::Base
belongs_to :album
belongs_to :genre
end
+4
View File
@@ -0,0 +1,4 @@
class AlbumStyle < ActiveRecord::Base
belongs_to :album
belongs_to :style
end
+6
View File
@@ -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
+3
View File
@@ -0,0 +1,3 @@
class ArtistAlias < ActiveRecord::Base
belongs_to :artist
end
+3
View File
@@ -0,0 +1,3 @@
class ArtistLink < ActiveRecord::Base
belongs_to :artist
end
+2
View File
@@ -0,0 +1,2 @@
class Genre < ActiveRecord::Base
end
+2
View File
@@ -0,0 +1,2 @@
class ReleaseFormat < ActiveRecord::Base
end
+2
View File
@@ -0,0 +1,2 @@
class Style < ActiveRecord::Base
end
+4
View File
@@ -0,0 +1,4 @@
class Track < ActiveRecord::Base
belongs_to :album
has_many :artists, :through => :track_artists
end
+4
View File
@@ -0,0 +1,4 @@
class TrackArtist < ActiveRecord::Base
belongs_to :track
belongs_to :artist
end