Skip to content
Browse files

merb_datamapper should hack around a bug in set_timestamps

  • Loading branch information...
1 parent 9e04521 commit 56ab0f1a9d3c6fec10a67fe3c57399e7f4b5a6dc @wycats committed Jan 19, 2009
Showing with 18 additions and 0 deletions.
  1. +18 −0 merb_datamapper/lib/merb_datamapper.rb
View
18 merb_datamapper/lib/merb_datamapper.rb
@@ -68,4 +68,22 @@ def _call_action(*)
Merb.add_generators generators / 'data_mapper_model'
Merb.add_generators generators / 'data_mapper_resource_controller'
Merb.add_generators generators / 'data_mapper_migration'
+
+ # Override bug in DM::Timestamps
+ Merb::BootLoader.after_app_loads do
+ module DataMapper
+ module Timestamp
+ private
+
+ def set_timestamps
+ return unless dirty? || new_record?
+ TIMESTAMP_PROPERTIES.each do |name,(_type,proc)|
+ if model.properties.has_property?(name)
+ model.properties[name].set(self, proc.call(self, model.properties[name])) unless attribute_dirty?(name)
+ end
+ end
+ end
+ end
+ end
+ end
end

2 comments on commit 56ab0f1

@dkubb
dkubb commented on 56ab0f1 Jan 31, 2009

This probably isn’t necessary any longer, provided the merb deps specify the last stable DM release (0.9.10) as the minimum dependency.

@mattetti
Collaborator

fair enough, removed in http://github.com/wycats/merb/commit/133111d5ee518c17ba8b78d00fb1961b9f66d036

Please sign in to comment.
Something went wrong with that request. Please try again.