Starting off simple, I would like to do some additional operations when an item's status is being updated. To do this I have added a before_update observer to a method in my model to take care of the logic.
There is a very rare case where I need to do something based on the record's previous status compared to the new one being set. My view has it's previous status, so getting the controller to pass it along to the model isn't a problem. I tried placing it in the array of data to update (hoping it would just get removed prior to hitting the database). Problem is, that array is sanitized before before_update is called.
Can you think of a way to be able to pass in additional information to my model's update method? I'd like to keep it as native as possible.
I wouldn't want to do an extra query prior to update in order to fetch the current query.
I wouldn't want to put any of the logic in my controller.
Starting off simple, I would like to do some additional operations when an item's status is being updated. To do this I have added a
before_update
observer to a method in my model to take care of the logic.There is a very rare case where I need to do something based on the record's previous status compared to the new one being set. My view has it's previous status, so getting the controller to pass it along to the model isn't a problem. I tried placing it in the array of data to update (hoping it would just get removed prior to hitting the database). Problem is, that array is sanitized before
before_update
is called.Can you think of a way to be able to pass in additional information to my model's update method? I'd like to keep it as native as possible.
Thanks for the help!