Comments (4)
This is an interesting one! It looks like because updater_id
on the nested record is changing, an autosave is triggered (this is always enabled for nested attributes), causing the foreign key on the nested record to be set here despite it not changing:
Interestingly, this isn't an issue on belongs_to
which already only sets the nested record's foreign key if it's changing:
I've got a fix passing against your script, just adding some coverage before I get a PR up.
from rails.
Got this up: #50901
from rails.
Thank you, that looks good and gets all my actual tests passing. This seems to be mirroring what #46759 did for belongs_to
, I found #46758 while searching for similar issues but didn't connect the dots.
from rails.
Thank you, that looks good and gets all my actual tests passing. This seems to be mirroring what #46759 did for
belongs_to
, I found #46758 while searching for similar issues but didn't connect the dots.
Ah nice find, I'll reference it in my PR, thanks!
from rails.
Related Issues (20)
- ActionView::Template::Error (undefined method `variant' for an instance of ActiveStorage::Attached::One): HOT 3
- Rails 7.1: `ActiveRecord::Base#query_constraints` and composite keys are incompatible with ActiveStorage HOT 1
- Array primary keys (e.g. composite) break `collection_singular_ids` method when using preload HOT 2
- Setter sometimes doesn't update the changes, and therefore, doesn't save later on. HOT 4
- url_for helper incorrectly combines query parameters on routes with a default parameter HOT 3
- find_or_create_by! behavior raises RecordNotFound in Rails 7.1 HOT 4
- Default docker setup is not resilient to host abrupt shutdown (ex. power loss). Puma won't due to uncleaned PID file. HOT 3
- ActiveRecord queries against an unmigrated database breaks Zeitwerk HOT 3
- 7.1.3.2 may have broken stimulus controllers HOT 3
- Setting an assets prefix leads to 405 errors on POST requests HOT 1
- `Model.query_constraints` with a single non-primary-key column raises a confusing error
- Docs: ActiveRecord validations - Skipping Validations fails to mention callbacks/timestamps in some cases HOT 2
- Updating delegated types using delegate type attributes produces orphaned children HOT 6
- If you set after_destroy_commit && after_create_commit calling the same method. Only one fires. HOT 3
- `CompatibilityTest6_0#test_datetime_doesnt_set_precision_on_change_column` fails
- [DOCS] Confusing description and broken link for config.action_view.erb_trim_mode
- [email protected] HOT 1
- `previous_changes` overwritten upon multiple saves with a transaction block HOT 2
- Explore ways to reload gems HOT 8
- Please release a 6.1 version with a patch for CVE-2024-26143 HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails.