Module: Permit::Models::RoleExtensions::RoleInstanceMethods

Defined in:
lib/models/role.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) key=(val)

Sets the key for the role with extra processing to convert it from a symbol and downcase it.

Parameters:

  • val (String, Symbol)

    the key value.



48
49
50
# File 'lib/models/role.rb', line 48

def key=(val)
  write_attribute :key, self.class.prepare_key(val)
end

- (Object) resource_requirement (protected)



53
54
55
# File 'lib/models/role.rb', line 53

def resource_requirement
  errors.add(:requires_resource, "cannot be true if authorize_resource is false") if !authorize_resource? && requires_resource?
end