Module: Goldiloader::BasePatch
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/goldiloader/active_record_patches.rb
Instance Method Summary collapse
- #auto_include_context ⇒ Object
- #goldiload(cache_name = nil, key: self.class.primary_key, &block) ⇒ Object
- #initialize_copy(other) ⇒ Object
- #reload ⇒ Object
Instance Method Details
#auto_include_context ⇒ Object
20 21 22 |
# File 'lib/goldiloader/active_record_patches.rb', line 20 def auto_include_context @auto_include_context ||= Goldiloader::AutoIncludeContext.new.register_model(self) end |
#goldiload(cache_name = nil, key: self.class.primary_key, &block) ⇒ Object
29 30 31 32 |
# File 'lib/goldiloader/active_record_patches.rb', line 29 def goldiload(cache_name = nil, key: self.class.primary_key, &block) cache_name ||= block.source_location.join(':') auto_include_context.preloaded(self, cache_name: cache_name, key: key, &block) end |
#initialize_copy(other) ⇒ Object
15 16 17 18 |
# File 'lib/goldiloader/active_record_patches.rb', line 15 def initialize_copy(other) super @auto_include_context = nil end |
#reload ⇒ Object
24 25 26 27 |
# File 'lib/goldiloader/active_record_patches.rb', line 24 def reload(*) @auto_include_context = nil super end |