Skip to content

Commit

Permalink
merb_datamapper should hack around a bug in set_timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Jan 19, 2009
1 parent 9e04521 commit 56ab0f1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions merb_datamapper/lib/merb_datamapper.rb
Expand Up @@ -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

0 comments on commit 56ab0f1

Please sign in to comment.