I’ve been reading about ActiveRecord::Callbacks and they’re really
cool. But I have a complex need I’m not sure they answer.
Let’s say we have a User model. User has a #status attribute, which
can be either “active”, “closed” or “blocked”.
I want to set a callback to perform an action if an “active” User has
been blocked. So I need to know:
- That the user has at first been in “active” status.
- That his status has been set to “blocked”.
I need to set the callback when someone tries to save him in this
state, so to sum up:
I need to run some logic when someone updates a user.status from
‘active’ to ‘blocked’.
Any idea how?
Maurice B. Gladwell