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
|
@ -62,6 +62,9 @@ module CouchRest
|
||||||
property(:updated_at, :read_only => true, :cast_as => 'Time', :auto_validation => false)
|
property(:updated_at, :read_only => true, :cast_as => 'Time', :auto_validation => false)
|
||||||
property(:created_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|
|
save_callback :before do |object|
|
||||||
object['updated_at'] = Time.now
|
object['updated_at'] = Time.now
|
||||||
object['created_at'] = object['updated_at'] if object.new?
|
object['created_at'] = object['updated_at'] if object.new?
|
||||||
|
|
Loading…
Reference in a new issue