lib/sequel/plugins/bitemporal.rb in sequel_bitemporal-0.6.9 vs lib/sequel/plugins/bitemporal.rb in sequel_bitemporal-0.6.10
- old
+ new
@@ -376,23 +376,25 @@
def pending_version_holds_changes?
return false unless @pending_version
return true unless current_version?
@current_version_values = current_version.values
- pending_version.values.detect do |key, new_value|
+ pending_version.columns.detect do |key|
+ new_value = pending_version.send key
case key
when :id, :master_id, :created_at, :expired_at
false
when :valid_from
- new_value && (
+ pending_version.values.has_key?(:valid_from) && (
new_value<current_version.valid_from ||
(
current_version.valid_to &&
new_value>current_version.valid_to
)
)
when :valid_to
- new_value || new_value!=current_version.valid_to
+ pending_version.values.has_key?(:valid_to) &&
+ new_value!=current_version.valid_to
else
if model.version_uses_string_nilifier
new_value = nil if current_version.nil_string? key, new_value
end
current_version.send(key)!=new_value