Having trouble with a somewhat unconventional modelling in Rails
2.2.2.

Take three table.

1. User model with primary integer id and a unique string guid.

2. Model X has foreign key to User as integer user_id and its model
includes
belongs_to :users

3. Model Y has foreign key to User as string user_guid and its model
includes
belongs_to :users, :foreign_key => 'user_guid'

This tells Rails which column to use in Model Y to look up Users.
But How do I tell Rails which column to use in User?

In other words, how do I tell Rails to join (or select) from
Users.guid instead of Users.id when  referencing Y.user?

The has_one and has_many association has a :primary_key option, but
this seems to be missing on the belongs_to association

How do people work around this?  Any help would be greatly
appreciated.

Thanks,
=Blair.

--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to