How do I add a column that points to another table in a Rails database? <p>Let's say I currently have a table titled "Report" and within Report, there are a bunch of strings, integers, timestamps, etc.</p> <p>Now, I want to somehow be able to see who is currently working on a certain report - all I need are names, but the key is it could be more than one name so just adding a string column to the Report table wouldn't work. Plus, the names would keep changing - at one point, "Steve" and "John" could be working on a report, but once "Steve" stops, I need to be able to get rid of his name from the table.</p> <p>I have a feeling that the correct way to do this is by: </p> <ul> <li>creating a new table titled "Viewers" and having just one string field (for the person's name) in there. I'd add rows to this table when a new viewer is detected.</li> <li>linking to indices within the Viewers table from the Report table. When a person stops viewing the report, the respective index is destroyed.</li> </ul> <p>I think that makes sense logically, but I'm hesitant to implement this without being sure that this is the way to go. Any help/feedback/suggestions would be appreciated!</p> <p>Edit:</p> <p>I created a model for my join table and it auto-generated a migration and added an integer "viewer_id" and an integer "report_id" like Vimsha suggested below. However, I can't correctly implement the join tables in my code for some reason - when I want to add to the new Table (report_viewers), I say:</p> <pre><code>@viewer = ReportViewer.new @viewer.viewer_id = get_current_user[:id] @viewer.report_id = this_report.id @viewer.save </code></pre> <p>However, when I access the table via </p> <pre><code>ReportViewer.where(:report_id =&gt; my_report.id).last.viewer_id.name (the viewer table has a string name) </code></pre> <p>it gives me a nil class. Do you know why?</p>