In after_update, possible to see previous value of record?

I have this situation where in an after_update, I would like to know
the previous value of the record instead of simply being notified the
record has been updated.

For example let’s say I had a table called ‘foo’ which had a field
‘new_flag’. I want to know when the ‘new_flag’ field changes from 0 –

1 in an after_update so I can do some business logic in the
after_update. My problem is in the after_update I don’t know how to
detect if that particular field got updated.

Is there some api call I can use to access the old object?


Use the acts_as_versioned plugin
You can use the API that will allow you to call the previous version
object and access its values.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs