Integrated Yehuda's new callback code from rails

This commit is contained in:
Peter Gumeson 2009-06-07 02:57:22 -07:00
parent 1c6e073b47
commit dc4787e905
8 changed files with 228 additions and 221 deletions

View file

@ -62,7 +62,7 @@ module CouchRest
property(:updated_at, :read_only => true, :cast_as => 'Time', :auto_validation => false)
property(:created_at, :read_only => true, :cast_as => 'Time', :auto_validation => false)
save_callback :before do |object|
set_callback :save, :before do |object|
object['updated_at'] = Time.now
object['created_at'] = object['updated_at'] if object.new?
end