Method: SecurityContext#observe

Defined in:
lib/security_context.rb

#observe(*resource_args) ⇒ Object

Call if a resource object was touched during an action. Will be called automatically for model objects.

Applies all rules that are currently active to the resource defined by resource_args. Raises a SecurityViolationError if a rule is violated.

Usage

observe :resource, @resource

where :resource is the resource type @resource belongs to, or

observe @resource

which is equivalent if @resource.resource_name == :resource



315
316
317
# File 'lib/security_context.rb', line 315

def observe(*resource_args)
  apply_context_rules(*resource_args)
end