Module: Goldiloader::RelationPatch
- Defined in:
- lib/goldiloader/active_record_patches.rb
Instance Method Summary collapse
- #auto_include(auto_include = true) ⇒ Object
- #auto_include!(auto_include = true) ⇒ Object
- #auto_include_value ⇒ Object
- #auto_include_value=(value) ⇒ Object
- #exec_queries ⇒ Object
Instance Method Details
#auto_include(auto_include = true) ⇒ Object
45 46 47 |
# File 'lib/goldiloader/active_record_patches.rb', line 45 def auto_include(auto_include = true) spawn.auto_include!(auto_include) end |
#auto_include!(auto_include = true) ⇒ Object
49 50 51 52 |
# File 'lib/goldiloader/active_record_patches.rb', line 49 def auto_include!(auto_include = true) self.auto_include_value = auto_include self end |
#auto_include_value ⇒ Object
54 55 56 |
# File 'lib/goldiloader/active_record_patches.rb', line 54 def auto_include_value @values.fetch(:auto_include, true) end |
#auto_include_value=(value) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/goldiloader/active_record_patches.rb', line 58 def auto_include_value=(value) if ::Goldiloader::Compatibility.pre_rails_7_2? assert_mutability! else assert_modifiable! end @values[:auto_include] = value end |
#exec_queries ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/goldiloader/active_record_patches.rb', line 37 def exec_queries return super if loaded? || !auto_include_value models = super Goldiloader::AutoIncludeContext.register_models(models, eager_load_values) models end |