Handling of ActiveRecord::RecordInvalid errors in actions #4046
manuelmeurer
started this conversation in
Feature feedback
Replies: 2 comments 8 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, that works! |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I discovered that if an action raises a
ActiveRecord::RecordInvalid
, the request returns a 422 response. In the UI, the view reloads, but there is no indication that an error happened.If any other error is raised in an action, it is also raised in the UI (at least in development).
I assume this is not the desired behavior and
ActiveRecord::RecordInvalid
should be treated the same way as other errors when executing actions?Trying to find the cause of this behavior, I thought is due to the fact that
Avo::ActionsController
inherits fromAvo::BaseApplicationController
, which includes the lineBut when I delete that line, nothing changes.
I also couldn't find any spec that checks what happens when an error is raised in an action.
Where would be a good place to add such a spec?
Beta Was this translation helpful? Give feedback.
All reactions