2012-10-30 05:42:16 +00:00
|
|
|
module JamRuby
|
|
|
|
|
class MusicianInstrument < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
self.table_name = "musicians_instruments"
|
|
|
|
|
|
|
|
|
|
self.primary_key = 'id'
|
|
|
|
|
|
2013-02-13 07:09:31 +00:00
|
|
|
# ensure most proficient, highest priority
|
2016-07-17 15:16:27 +00:00
|
|
|
default_scope { order('proficiency_level DESC, priority ASC') }
|
2013-02-13 07:09:31 +00:00
|
|
|
|
2014-06-24 03:26:27 +00:00
|
|
|
# proficiency is 1 = Beginner, 2 = Intermediate, 3 = Expert
|
|
|
|
|
|
VRFS-3242 : Schema and model changes required for band profile functionality.
* Additional attributes for band_type, band_status, concert_count,
add_new_members, play_commitment, touring_option, paid_gigs,
hourly_rate, gig_minimum
* For joined table musician_instruments, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table performance_stamples, remove the hard requirement
that they be joined to a user, rather a “player” that is polymorphic.
* For joined table online_presences, remove the hard requirement that
they be joined to a user, rather a “player” that is polymorphic.
* Change models as appropriate with new attributes and modify
belongs_to / has_many directives as necessary.
* Fix existing usages of user_id to work with polymorphic player_id.
* Fix tests that use user_id
* Add new tests that exercise online_presence, performance_samples, and
instruments that target a band, rather than a user.
2015-05-14 02:06:14 +00:00
|
|
|
belongs_to :player, polymorphic: true
|
2012-11-21 19:48:39 +00:00
|
|
|
belongs_to :instrument, :class_name => "JamRuby::Instrument"
|
2012-10-30 05:42:16 +00:00
|
|
|
|
2015-08-25 08:23:52 +00:00
|
|
|
LEVEL_BEGIN = 1
|
|
|
|
|
LEVEL_INTERMEDIATE = 2
|
|
|
|
|
LEVEL_EXPERT = 3
|
|
|
|
|
PROFICIENCY_RANGE = (LEVEL_BEGIN..LEVEL_EXPERT)
|
|
|
|
|
|
2012-10-30 05:42:16 +00:00
|
|
|
def description
|
|
|
|
|
@description = self.instrument.description
|
|
|
|
|
end
|
|
|
|
|
end
|
2015-08-25 08:23:52 +00:00
|
|
|
end
|