Module: Zuul::ActiveRecord::ContextMethods
- Defined in:
- lib/zuul/active_record.rb
Overview
These are included in roles & permissions objects and assigned roles & permissions objects to provide easy access to the context for that object.
Class Method Summary collapse
Instance Method Summary collapse
-
#context ⇒ Object
Return a Zuul::Context object representing the context for the role.
-
#context=(context) ⇒ Object
Parse a context into an Zuul::Context and set the type and id.
Class Method Details
.included(base) ⇒ Object
339 340 341 342 |
# File 'lib/zuul/active_record.rb', line 339 def self.included(base) base.send :attr_accessible, :context if ::Zuul .should_whitelist? end |
Instance Method Details
#context ⇒ Object
Return a Zuul::Context object representing the context for the role
345 346 347 |
# File 'lib/zuul/active_record.rb', line 345 def context Zuul::Context.new(context_type, context_id) end |
#context=(context) ⇒ Object
Parse a context into an Zuul::Context and set the type and id
350 351 352 353 354 |
# File 'lib/zuul/active_record.rb', line 350 def context=(context) context = Zuul::Context.parse(context) self.context_type = context.class_name self.context_id = context.id end |