Module: ActiveRecord::Persistence
- Defined in:
- lib/activerecord-bitemporal/bitemporal.rb
Instance Method Summary collapse
-
#active_record_bitemporal_original_reload ⇒ Object
MEMO: Must be override ActiveRecord::Persistence#reload.
- #reload(options = nil) ⇒ Object
Instance Method Details
#active_record_bitemporal_original_reload ⇒ Object
MEMO: Must be override ActiveRecord::Persistence#reload
362 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 362 alias_method :active_record_bitemporal_original_reload, :reload |
#reload(options = nil) ⇒ Object
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 364 def reload( = nil) return active_record_bitemporal_original_reload() unless self.class.bi_temporal_model? self.class.connection.clear_query_cache fresh_object = ActiveRecord::Bitemporal.with_bitemporal_option(**bitemporal_option) { if apply_scoping?() _find_record() else self.class.unscoped { self.class.bitemporal_default_scope.scoping { _find_record() } } end } @association_cache = fresh_object.instance_variable_get(:@association_cache) @attributes = fresh_object.instance_variable_get(:@attributes) @new_record = false @previously_new_record = false # NOTE: Hook to copying swapped_id @_swapped_id = fresh_object.swapped_id self end |