New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restrict_with_error raises exception when destroying CollectionProxy #35298
Comments
|
Here is the backtrace from the |
|
It looks like this is not a bug but is intended behavior. From # Deletes the +records+ and removes them from this association calling
# +before_remove+ , +after_remove+ , +before_destroy+ and +after_destroy+ callbacks.
#
# Note that this method removes records from the database ignoring the
# +:dependent+ option.
def destroy(*records)
delete_or_destroy(records, :destroy)
endWhy is the |
|
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
|
I seem to have the same issue in Rails 6.0.2. Using The second one makes sense but the first one should not raise an exception IMHO. |
|
@cimm did you find a workaround? |
|
Hi @DaAwesomeP, sorry this has been years ago, I no longer remember if or how I handled this. |
Steps to reproduce
Executable Test Case
Expected behavior
To not raise exception due to
restrict_with_errorand non-bangupdate.Actual behavior
Raises exception like
restrict_with_exceptionwould despiterestrict_with_error.System configuration
Rails version: 5.2.2
Ruby version: 2.6.1
The text was updated successfully, but these errors were encountered: