Class: ActiveModel::Relation::Scoping::ScopeRegistry
- Inherits:
-
Object
- Object
- ActiveModel::Relation::Scoping::ScopeRegistry
- Defined in:
- lib/active_model/relation/scoping.rb
Class Method Summary collapse
Instance Method Summary collapse
- #current_scope(model) ⇒ Object
-
#initialize ⇒ ScopeRegistry
constructor
A new instance of ScopeRegistry.
- #set_current_scope(model, value) ⇒ Object
Constructor Details
#initialize ⇒ ScopeRegistry
Returns a new instance of ScopeRegistry.
27 28 29 |
# File 'lib/active_model/relation/scoping.rb', line 27 def initialize @current_scope = {} end |
Class Method Details
.instance ⇒ Object
22 23 24 |
# File 'lib/active_model/relation/scoping.rb', line 22 def instance ActiveSupport::IsolatedExecutionState[:active_model_scope_registry] ||= new end |
Instance Method Details
#current_scope(model) ⇒ Object
31 32 33 |
# File 'lib/active_model/relation/scoping.rb', line 31 def current_scope(model) @current_scope[model.name] end |
#set_current_scope(model, value) ⇒ Object
35 36 37 |
# File 'lib/active_model/relation/scoping.rb', line 35 def set_current_scope(model, value) @current_scope[model.name] = value end |