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
414 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 414 alias_method :active_record_bitemporal_original_reload, :reload |
#reload(options = nil) ⇒ Object
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 415 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_previously_was = nil @_swapped_id = fresh_object.swapped_id @previously_force_updated = false self end |