Module: ActiveRecord::Bitemporal::Persistence::PersistenceOptionable
Instance Method Summary
collapse
Methods included from Optionable
#bitemporal_option, #bitemporal_option_merge!, #with_bitemporal_option
Instance Method Details
#bitemporal_at(datetime, &block) ⇒ Object
269
270
271
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 269
def bitemporal_at(datetime, &block)
transaction_at(datetime) { valid_at(datetime, &block) }
end
|
#bitemporal_option_merge_with_association!(other) ⇒ Object
273
274
275
276
277
278
279
280
281
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 273
def bitemporal_option_merge_with_association!(other)
bitemporal_option_merge!(other)
each_association(deep: true, only_cached: true).each do |association|
next unless association.respond_to?(:bitemporal_option_merge!)
association.bitemporal_option_merge!(other)
end
end
|
#force_update(&block) ⇒ Object
253
254
255
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 253
def force_update(&block)
with_bitemporal_option(force_update: true, &block)
end
|
#force_update? ⇒ Boolean
257
258
259
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 257
def force_update?
bitemporal_option[:force_update].present?
end
|
#transaction_at(datetime, &block) ⇒ Object
265
266
267
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 265
def transaction_at(datetime, &block)
with_bitemporal_option(transaction_datetime: datetime, &block)
end
|
#transaction_datetime ⇒ Object
291
292
293
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 291
def transaction_datetime
bitemporal_option[:transaction_datetime]&.in_time_zone
end
|
#valid_at(datetime, &block) ⇒ Object
261
262
263
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 261
def valid_at(datetime, &block)
with_bitemporal_option(valid_datetime: datetime, &block)
end
|
#valid_date ⇒ Object
287
288
289
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 287
def valid_date
valid_datetime&.to_date
end
|
#valid_datetime ⇒ Object
283
284
285
|
# File 'lib/activerecord-bitemporal/bitemporal.rb', line 283
def valid_datetime
bitemporal_option[:valid_datetime]&.in_time_zone
end
|