2012-08-25 04:14:51 +00:00
|
|
|
class User < ActiveRecord::Base
|
2012-09-02 11:12:26 +00:00
|
|
|
# Include default devise modules. Others available are:
|
|
|
|
# :token_authenticatable, :confirmable,
|
|
|
|
# :lockable, :timeoutable and :omniauthable
|
2012-10-14 12:46:19 +00:00
|
|
|
devise :database_authenticatable, :registerable,
|
2012-09-02 11:12:26 +00:00
|
|
|
:recoverable, :rememberable, :trackable, :validatable
|
|
|
|
|
|
|
|
# Setup accessible (or protected) attributes for your model
|
2013-01-25 13:01:02 +00:00
|
|
|
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :member, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level, :certifications
|
2012-08-25 04:14:51 +00:00
|
|
|
|
2012-10-14 12:46:19 +00:00
|
|
|
has_many :cards
|
2013-01-25 10:50:53 +00:00
|
|
|
has_many :user_certifications
|
|
|
|
has_many :certifications, :through => :user_certifications
|
2013-01-25 13:01:02 +00:00
|
|
|
|
|
|
|
def member_status
|
|
|
|
# 1 = inactive, show an X
|
|
|
|
if self.member == 1 then
|
|
|
|
"<span class='hoverinfo' title='Inactive'>!!</span>"
|
|
|
|
# 25 or higher is paying, show a check
|
|
|
|
elsif self.member == 25 then
|
|
|
|
"<span class='hoverinfo' title='25'>✓</span>"
|
|
|
|
elsif self.member == 50 then
|
|
|
|
"<span class='hoverinfo' title='50'>✓</span>"
|
|
|
|
elsif self.member == 100 then
|
|
|
|
"<span class='hoverinfo' title='100'>✓</span>"
|
|
|
|
end
|
|
|
|
end
|
2012-08-25 04:14:51 +00:00
|
|
|
end
|