Sha256: 3aa80d9ae0c641f30be4e64e736d5db2427a25f5ec0b7e642ea5cb1abdbaf76e
Contents?: true
Size: 926 Bytes
Versions: 9
Compression:
Stored size: 926 Bytes
Contents
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me has_one :user_has_role has_one :role, :through => :user_has_role belongs_to :user_group belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id' enju_question_user def has_role?(role_in_question) return false unless role return true if role.name == role_in_question case role.name when 'Administrator' return true when 'Librarian' return true if role_in_question == 'User' else false end end end
Version data entries
9 entries across 9 versions & 1 rubygems