jam-cloud/ruby/lib/jam_ruby/models/genre.rb

24 lines
574 B
Ruby
Raw Normal View History

module JamRuby
class Genre < ActiveRecord::Base
2012-10-28 02:35:28 +00:00
self.primary_key = 'id'
# bands
has_many :band_genres, class_name: "JamRuby::BandGenre"
has_many :bands, class_name: "JamRuby::Band", :through => :band_genres
# music sessions
has_many :music_sessions, :class_name => "JamRuby::MusicSession"
# genres
has_and_belongs_to_many :recordings, :class_name => "JamRuby::Recording", :join_table => "recordings_genres"
# jam tracks
has_many :jam_tracks, :class_name => "JamRuby::JamTrack"
def to_s
description
end
end
end