I run the risk of palm-to-forehead here, but I can't quite figure out how to do this with Rails' ActiveRecord sugar.
I have a tickets
table that has two columns (submitter_id
and assignee_id
) that should each reference a different user from the users
table (specifically the id
column in the users
table). I'd like to be able to do things like ticket.submitter.name
and ticket.assignee.email
using ActiveRecord's associations. Submitter and Assignee are simply user objects under different associative names.
The only thing I've found that comes close to what I am doing is using polymorphic associations, but in the end I'm fairly certain that it's not really what I need. I'm not going to have multiple types, both submitter and assignee will be users, and very well could be two different users.
Any help would be fantastic. Thanks!