2012-10-25 12:11:10 +00:00
|
|
|
module JamRuby
|
|
|
|
|
class Genre < ActiveRecord::Base
|
|
|
|
|
|
2012-10-28 02:35:28 +00:00
|
|
|
self.primary_key = 'id'
|
2012-10-25 12:11:10 +00:00
|
|
|
|
2012-10-30 05:42:16 +00:00
|
|
|
# bands
|
2014-02-19 22:56:13 +00:00
|
|
|
has_many :band_genres, class_name: "JamRuby::BandGenre"
|
|
|
|
|
has_many :bands, class_name: "JamRuby::Band", :through => :band_genres
|
2012-10-30 05:42:16 +00:00
|
|
|
|
2014-05-06 21:17:26 +00:00
|
|
|
|
|
|
|
|
# music sessions
|
|
|
|
|
has_many :music_sessions, :class_name => "JamRuby::MusicSession"
|
|
|
|
|
|
2012-12-02 07:06:51 +00:00
|
|
|
# genres
|
|
|
|
|
has_and_belongs_to_many :recordings, :class_name => "JamRuby::Recording", :join_table => "recordings_genres"
|
|
|
|
|
|
2014-11-04 20:55:12 +00:00
|
|
|
# jam tracks
|
|
|
|
|
has_many :jam_tracks, :class_name => "JamRuby::JamTrack"
|
2014-03-05 23:18:53 +00:00
|
|
|
|
|
|
|
|
def to_s
|
|
|
|
|
description
|
|
|
|
|
end
|
2012-10-25 12:11:10 +00:00
|
|
|
end
|
|
|
|
|
end
|