Hi,
I have been trying to join a table with another which has got a
polymporhic set of columns. So I don’t know what would be there in
“_type" column upfront. Moreover the join branches out based on what
is present in the "_type”. For example I have a subscription model
like this:
Subscription{:user_id, :user_type)
There could be 2 types of users, Family or Friend. And these types of
users have a login which is stored in logins table.
How can I connect subscriptions table to logins table? My goal is to
use subscription.family.login if it’s a family user and
subscription.friend.login if it’s a friend user.
If there was no polymorphic relation then I could’ve said:
“subscriptions s LEFT JOIN family f ON s.id = f.id”
Thanks
subbu