Created a record with FactoryBot in a test. This record has 4 associations. All of them created as well, properly. When destroying said record, one of the 4 associations isn’t destroyed despite being configured to be — unless I first reload said record. Feels like a bug. Known?
-
-
Replying to @olivierlacan
Interesting! I haven’t heard of this in FB; first thing I’d encourage you to do is recreate the same records without FB and see if it continues not to destroy one of the associations
2 replies 0 retweets 1 like -
Replying to @joshuaclayton
Confirmed as an AR bug. Or at least something very specifically weird with one of my associations.pic.twitter.com/3magjZ7ayT
1 reply 0 retweets 0 likes -
Replying to @olivierlacan @joshuaclayton
If you haven’t already, I’ve had success with configuring inverse_of on the associations. It seems to give AR more context about your data model and I find strange behavior can sometimes correct itself. Good luck

1 reply 0 retweets 0 likes -
Replying to @arronmabrey @joshuaclayton
AFAIK inverse_of *should* be unnecessary on modern Railw versions now. But maybe
@sgrif knows something I don’t.2 replies 0 retweets 0 likes -
That very well could be the case. I’m in process of moving from 4.x to 5.x. So I’m only speaking from a 4.x perspective
1 reply 0 retweets 0 likes -
`inverse_of` stopped being needed in 4.1 :)
1 reply 0 retweets 0 likes -
Any off the cuff idea why some associations would be destroyed and not others until the instance is reloaded? Autosave required for all model associations to be destroyed in cascade?
1 reply 0 retweets 0 likes
Nothing stands out from what you've shown me. Is it a through association? Are there other macros involved? It's almost certainly a bug in some weird feature interaction
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.