How do I create a migration for a model that has two references to the same model.
I have a user model with two roles, buyer and seller, I also have a sales model so each sale should have one buyer and one seller.
I've seen this answer that would suggest my sales model should look like
class Sale < ActiveRecord::Base
belongs_to :buyer, :class_name => 'User', :foreign_key => 'buyer_id'
belongs_to :seller, :class_name => 'User', :foreign_key => 'seller_id'
end
but I don't know how to create the migration and get it to work...!