Thanks for explaining the _id meaning. I didn't know that that's how 
Rails associates tables.

> So, that leave us with the following design, when following Rails 
> conventions:
> 
> Member:
> id | member_number | first_name | last_name
> 
> Invitation:
> id | member_id | date
> 
> class Member << ActiveRecord::Base
>   has_one :invitation
> end
> 
> class Invitation << ActiveRecord::Base
>   belongs_to :member
> end

However, in my case invitations.member_id needs to be 
invitations.member_number and it should reference the 
members.member_number. Here's why - we do a lot of MYSQL lookup and if 
we quickly want to glance thought the invitations table, we can look 
member_numbers and tell who received invitations. The field 
member_number (previously member_id) comes from a legacy database and to 
us it is a lot more "readable" than ID. Does that make sense? Should we 
have done something better?

So the condition we're looking for here is:

on members.member_number = invitation.member_number

Should we just make member_number our primary key?
-- 
Posted via http://www.ruby-forum.com/.

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

Reply via email to