lib/sequel/plugins/bitemporal.rb in sequel_bitemporal-0.1.2 vs lib/sequel/plugins/bitemporal.rb in sequel_bitemporal-0.1.3
- old
+ new
@@ -54,10 +54,11 @@
def update_attributes(attributes={})
if !new? && attributes.delete(:partial_update) && current_version
current_attributes = current_version.values.dup
current_attributes.delete :id
+ current_attributes.delete :valid_from
attributes = current_attributes.merge attributes
end
self.attributes = attributes
save raise_on_failure: false
end
@@ -107,10 +108,10 @@
private
def prepare_pending_version
point_in_time = Time.now
pending_version.created_at = point_in_time
- pending_version.valid_from = point_in_time if !pending_version.valid_from || pending_version.valid_from.to_time<point_in_time
+ pending_version.valid_from ||= point_in_time
end
def save_pending_version
pending_version.valid_to ||= Time.utc 9999
success = add_version pending_version
\ No newline at end of file