0

I have a Booking model and User model.

class Booking < ActiveRecord::Base
  belongs_to :buyer, class_name: "User"
  belongs_to :seller, class_name: "User"
end

This is my User.rb

class User < ActiveRecord::Base
 has_many :bookings, foreign_key: "WHAT_SHOULD_I_GIVE_HERE", dependent: :destroy
end

In User.rb, how can I mention that both 'seller_id' and 'buyer_id' are the foreign_keys?

TheGuy
  • 349
  • 6
  • 17

0 Answers0