model user
id (automatic primary)
fname
lname
user_rrid (foreign key) - string "123456"
model email
id (automatic primary)
e_addresss
user_rrid (foreign key) - string "123456"
e_type
i would like to find a user by fname
@user = User.find_by_fname("John")
then use...
@user.email.e_address
@user.email.e_type
i would also like to go the other way. search email based on e_address
and find the user.
can you please show how the user.rb and email.rb files should be set
up. i have looked thru the docs and googled and everything i try does
not work.
i have tried using foreign_key but it does not work.
thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---