Sha256: 9e4c97a220aed45f1f645613e4a135dd9f6d8d17859316ae362edab427a9695d
Contents?: true
Size: 1.06 KB
Versions: 18
Compression:
Stored size: 1.06 KB
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 :required_role, :class_name => 'Role', :foreign_key => 'required_role_id' has_many :bookmarks, :dependent => :destroy def owned_tags_by_solr bookmark_ids = bookmarks.collect(&:id) if bookmark_ids.empty? [] else Tag.bookmarked(bookmark_ids) end end 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
18 entries across 18 versions & 1 rubygems