Module: ActiveRecord::Scoping::ClassMethods

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#current_scope(skip_inherited_scope = false) ⇒ Object



26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 26

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

#current_scope=(scope) ⇒ Object



30
31
32
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 30

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

#global_current_scope(skip_inherited_scope = false) ⇒ Object



34
35
36
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 34

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

#global_current_scope=(scope) ⇒ Object



38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 38

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.



17
18
19
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 17

def scope_attributes
  all.scope_for_create
end

#scope_attributes?Boolean

Are there attributes associated with this scope?

Returns:

  • (Boolean)


22
23
24
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 22

def scope_attributes?
  current_scope
end

#scope_registryObject



42
43
44
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/scoping.rb', line 42

def scope_registry
  ScopeRegistry.instance
end