Module: ActiveSecurity::Scoped::Configuration
- Defined in:
- lib/active_security/scoped.rb
Overview
This module adds the ‘:scope` configuration option to ActiveSecurity::Configuration.
Instance Attribute Summary collapse
-
#scope ⇒ Object
Gets the scope value.
Instance Method Summary collapse
-
#scope_columns ⇒ Object
Gets the scope columns.
Instance Attribute Details
#scope ⇒ Object
Gets the scope value.
When setting this value, the argument should be a symbol referencing a ‘belongs_to` relation, or a column.
78 79 80 |
# File 'lib/active_security/scoped.rb', line 78 def scope @scope end |
Instance Method Details
#scope_columns ⇒ Object
Gets the scope columns.
Checks to see if the ‘:scope` option passed to Base#active_security refers to a relation, and if so, returns the relation’s foreign key. Otherwise it assumes the option value was the name of column and returns it cast to a String.
88 89 90 |
# File 'lib/active_security/scoped.rb', line 88 def scope_columns [@scope].flatten.map { |s| (reflection_foreign_key(s) or s).to_s } end |