I have searched a lot for this issue with no luck…
I have a model with a before_update method, I can’t replace it with a validator because the actual method checks the existance of many things and update many others. My question is, How can I raise an error if a process from the before_update method fails? Something like:
def update_status
if !(many verifications and updates)
self.errors[:base] << "Could not update if ...."
end
end
With the abobe code I get the update notice from the controller after the page loads, but I want to show the error from the before_update method. How can I show the error to the user?
Thanks a lot!!
Now do show the error message on the controller you could do something like this: