add silent settings for created_at and updated_at, allows for mass assignment with semantics that match rails
This commit is contained in:
parent
31180f6bc7
commit
ffceaec57d
1 changed files with 3 additions and 0 deletions
|
@ -62,6 +62,9 @@ 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)
|
||||
|
||||
def created_at=(ignored); end
|
||||
def updated_at=(ignored); end
|
||||
|
||||
save_callback :before do |object|
|
||||
object['updated_at'] = Time.now
|
||||
object['created_at'] = object['updated_at'] if object.new?
|
||||
|
|
Loading…
Reference in a new issue