I'm building an app that needs to make a comparison between two people and I'm wondering how to best build the models, and if I'm doing this correctly.
I'm representing each partner as a User, so I wanted to keep just a user table and a comparisons table (the comparisons table will keep all the comparison data, the user model will hold all the data about that individual user)
I'm thinking of making a User-to-User self-referential join through a "comparison" model.
So, I'd have two models: the user model, and a comparison model
The user model would look something like this: class User < ActiveRecord::Base belongs_to :partner, :through => :comparisons
:through is not a valid option on belongs_to, you can only use it on :has_many
I honestly have no idea if this will work... does this look close?
Sorry, don't think so.
Maybe with a little more insight on what you're trying to do with the comparison Model, someone can move you towards the goal.