Forum: Ruby on Rails Help with foreign keys, two keys joining same table

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sean Mathews (Guest)
on 2006-02-16 22:34
(Received via mailing list)
Hey All

Total nube here so please be gentle.  My scenario is this:

I have a table containing pages (named pages)
I have a table with users (named users)

In the pages table I want to have a user_id indicating the owner of the
page from the users table.  This was easy to accomplish with scaffolding
and editing the actions etc.

BUT I also want to have an editedby_id, which references another user in
the users table who was the last editor of the page.  How do I go about
setting this up.  The bit about adding the first user_id is easy.
Adding a second reference to the users table is the hard bit.  Help.

This topic is locked and can not be replied to.