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



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

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

#current_scope=(scope) ⇒ Object



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

def current_scope=(scope)
  ScopeRegistry.set_current_scope(self, scope)
end

#global_current_scope(skip_inherited_scope = false) ⇒ Object



33
34
35
# File 'lib/active_record/scoping.rb', line 33

def global_current_scope(skip_inherited_scope = false)
  ScopeRegistry.global_current_scope(self, skip_inherited_scope)
end

#global_current_scope=(scope) ⇒ Object



37
38
39
# File 'lib/active_record/scoping.rb', line 37

def global_current_scope=(scope)
  ScopeRegistry.set_global_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.



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

def scope_attributes
  all.scope_for_create
end

#scope_attributes?Boolean

Are there attributes associated with this scope?

Returns:

  • (Boolean)


21
22
23
# File 'lib/active_record/scoping.rb', line 21

def scope_attributes?
  current_scope
end

#scope_registryObject



41
42
43
# File 'lib/active_record/scoping.rb', line 41

def scope_registry
  ScopeRegistry.instance
end