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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---