Wednesday, March 7, 2012

[Rails] Foreign keys in order to send email

Hi all,

I have a problem at the moment and am not sure what I should do. It is
in regards to relationships between tables and whether I need foreign
keys.

I have two tables in my database; users and games. Users includes all
the users information (username, email, address, password etc.) Games
includes all the games information (name, genre, console user_id). As
you may have noticed the games table includes the users id in order to
associate the relationship between the two which is every game needs an
associated user.

What I wish to do is on each games show.html.erb page, I have a button
which should send an email to the owner of that game in order to let
them now that the currently signed in user is interested in trading that
game.

I am wondering how I would do this. Does the user_id automatically link
all the users associated data or just the id. If not then how would I
declare the users email as a foreign key in order for me to call the
users email to be sent to?

Any help would be much appreciated. Thank you

Christopher Jones

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate