I've just added a couple of fields to one of our models (Resource):
active (boolean) and activated_at (datetime).
I want to set it up so that if i make a restful call to update, and set
active to true, ie
"/resources/15?active=true" [PUT]
then activated_at is automatically set to Time.now.
I can't quite work out how to set this up though...it's almost like a
before_save, where i check if active was JUST SET to true, or we just
got a request to make it true, as opposed to simply testing if it's
true.
I've just added a couple of fields to one of our models (Resource):
active (boolean) and activated_at (datetime).
I want to set it up so that if i make a restful call to update, and
set
active to true, ie
"/resources/15?active=true" [PUT]
then activated_at is automatically set to Time.now.
I can't quite work out how to set this up though...it's almost like a
before_save, where i check if active was JUST SET to true, or we just
got a request to make it true, as opposed to simply testing if it's
true.
Does the dirty changes tracking in rails 2.1 help you?