Module: ActiveRecord::Scoping::ClassMethods

Defined in:
lib/active_record/scoping.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#current_scope(skip_inherited_scope = false) ⇒ Object


15
16
17
# File 'lib/active_record/scoping.rb', line 15

def current_scope(skip_inherited_scope = false)
  ScopeRegistry.value_for(:current_scope, self, skip_inherited_scope)
end

#current_scope=(scope) ⇒ Object


19
20
21
# File 'lib/active_record/scoping.rb', line 19

def current_scope=(scope)
  ScopeRegistry.set_value_for(:current_scope, self, scope)
end

#scope_attributesObject

Collects attributes from scopes that should be applied when creating an AR instance for the particular class this is called on.


25
26
27
# File 'lib/active_record/scoping.rb', line 25

def scope_attributes
  all.scope_for_create
end

#scope_attributes?Boolean

Are there attributes associated with this scope?

Returns:

  • (Boolean)

30
31
32
# File 'lib/active_record/scoping.rb', line 30

def scope_attributes?
  current_scope
end