Class: Role

Inherits:
ApplicationRecord show all
Defined in:
app/models/role.rb

Overview

Defines named roles for users that may be applied to objects in a polymorphic fashion. For example, you could create a role “moderator” for an instance of a model (i.e., an object), a model class, or without any specification at all.

Defined Under Namespace

Modules: Authorized Classes: UserRole

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Class Method Details

.keysObject


30
31
32
# File 'app/models/role.rb', line 30

def self.keys
  distinct.pluck(:name)
end

Instance Method Details

#touch_authorizableObject


34
35
36
# File 'app/models/role.rb', line 34

def touch_authorizable
  authorizable&.touch # rubocop:disable Rails/SkipsModelValidations
end