Why your members table have a column called member_id?

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208



On Wed, Oct 29, 2008 at 6:19 PM, Greg Lazarev
<[EMAIL PROTECTED]> wrote:
>
> Here's my situation:
>
> Let's say, I have a "members" table that tools like this:
>
> id | member_id | name |
>
> and I have a "invitation" table that looks like this:
>
> id | member_id | date |
>
> In my case, invitation.member_id needs to be the key to reference
> members.member_id
>
> What do I need to do in my models so I can do things like:
>
> member.invitation.date
>
> I've tried doing:
>
> class Member
>  has_one :invitation, :foreign_key => "member_id"
> end
>
> class Invitation
>  belongs_to :member, :foreign_key => "member_id"
> end
>
> Any ideas?
>
> Thanks.
> --
> 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