Adding certifications; messed up adding certification_users so not staging those

This commit is contained in:
2013-01-25 03:12:25 -07:00
parent fe283b051f
commit 43d949dc1d
20 changed files with 264 additions and 4 deletions

View File

@@ -5,10 +5,14 @@ class Ability
if !user.nil?
if user.admin?
can :manage, :all
else
can :read, User
can :read, Card, :user_id => user.id
end
if user.instructor?
can :manage, Certification
end
can :read, User
can :read, Certification
can :read, Card, :user_id => user.id
end
# Define abilities for the passed in user here. For example:
#

View File

@@ -0,0 +1,4 @@
class Certification < ActiveRecord::Base
attr_accessible :description, :name
has_many :users, :through => :certifications_users
end

View File

@@ -6,7 +6,8 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :active, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :admin, :instructor, :active, :emergency_name, :emergency_phone, :current_skills, :desired_skills, :waiver, :emergency_email, :phone, :payment_method, :orientation, :member_level
has_many :cards
has_many :certifications, :through => :certifications_users
end