module JamRuby
  class Genre < ActiveRecord::Base

    self.primary_key = 'id'

    # bands
    # has_many :genre_players, class_name: "JamRuby::GenrePlayer"
    # has_many :bands, class_name: "JamRuby::Band", through: :genre_players, condition: ['player_type = ?', 'JamRuby::Band'] 
    # has_many :users, class_name: "JamRuby::User", through: :genre_players, condition: ['player_type = ?', 'JamRuby::User'] 


    # 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
