When creating a has_many
or has_one
association with the inverse_of
option, rails has all the info it needs to figure out what the foreign_key
on the associated model should be using reflection.
When I first went through the docs I thought that this was the existing behaviour so it tripped me up a bit.
I can’t imagine this breaking anything as it doesn’t change the default, and anywhere where this would change the inferred foreign_key
it would’ve been broken otherwise I think.
Also as far as I can tell its a 2 line change: Infer `foerign_key` when `inverse_of` is present by Tiedye · Pull Request #47797 · rails/rails · GitHub