26 lines
637 B
Ruby
26 lines
637 B
Ruby
module JamRuby
|
|
class MusicianInstrument < ActiveRecord::Base
|
|
|
|
self.table_name = "musicians_instruments"
|
|
|
|
self.primary_key = 'id'
|
|
|
|
# ensure most proficient, highest priority
|
|
default_scope { order('proficiency_level DESC, priority ASC') }
|
|
|
|
# proficiency is 1 = Beginner, 2 = Intermediate, 3 = Expert
|
|
|
|
belongs_to :player, polymorphic: true
|
|
belongs_to :instrument, :class_name => "JamRuby::Instrument"
|
|
|
|
LEVEL_BEGIN = 1
|
|
LEVEL_INTERMEDIATE = 2
|
|
LEVEL_EXPERT = 3
|
|
PROFICIENCY_RANGE = (LEVEL_BEGIN..LEVEL_EXPERT)
|
|
|
|
def description
|
|
@description = self.instrument.description
|
|
end
|
|
end
|
|
end
|