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
Incorrectly raising ReadonlyAttributeError
when autosaving has_one
association with readonly foreign key
#50897
Comments
ReadonlyAttributeError
when that attribute hasn't changedReadonlyAttributeError
when changing column before validation in validates_associated
This is an interesting one! It looks like because
Interestingly, this isn't an issue on
I've got a fix passing against your script, just adding some coverage before I get a PR up. |
Got this up: #50901 |
ReadonlyAttributeError
when changing column before validation in validates_associated
ReadonlyAttributeError
when autosaving has_one
association with readonly foreign key
…-fk-when-unchanged [Fix #50897] Autosaving `has_one` sets foreign key attribute when unchanged
…-fk-when-unchanged [Fix #50897] Autosaving `has_one` sets foreign key attribute when unchanged
Rails 7.1 sets
raise_on_assign_to_attr_readonly
to true. In the following repro I set a column unrelated toattr_readonly
yet the error is still being set. If I stop setting this column the error goes away.Steps to reproduce
System configuration
Rails version: master
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: