Open waiting-for-dev opened 5 years ago
I can't reproduce this anymore using master branches.
Quick update: I can reproduce it when it's:
attribute :bad_name_id, Types::Integer, alias: :user_id
I moved this to rom-sql since it's sql-specific. We need to set combine_keys
option if there are fk aliases. ie if you do this:
belongs_to(:user, combine_keys: { user_id: :id })
...then it's gonna work.
Describe the bug
If you have a
belongs_to
association where the foreign key attribute has been aliased, the association is always loaded asnil
even when the foreign key attribute is populated.To Reproduce
or
Expected behavior
I would expected that foreign key inference is not affected by aliasing the attribute at the application level.
Your environment
Resources
Original source in the discussion forum