Sean Mathews
2006-Feb-16 20:32 UTC
[Rails] Help with foreign keys, two keys joining same table
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. Please. S