Closed kwando closed 7 years ago
This will be auto-inferred in rom-sql 2.0 but for now you need to do:
belongs_to :users, as: :author, relation: :authors, foreign_key: :author_id
The reason why this is needed now is because when associations are defined we don't have relations yet.
Thanks a lot for the quick reply, that works like I want :)
I'm gonna close this one since it'll be improved in rom-sql 2.0 and it's on the roadmap
I have a relation in my app that is not registered with the same name as the underlying SQL table. In the example below my
users
table is registered with the relation name:authors
.Is there a way to make this work as "expected" (as I expect)?
This blows up at the last line with the following error