Foreign_key problems

model user
id (automatic primary)
user_rrid (foreign key) - string “123456”

model email
id (automatic primary)
user_rrid (foreign key) - string “123456”

i would like to find a user by fname
@user = User.find_by_fname(“John”)
then use…

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs