I'm a newbie in code, and I'm trying to set up two connected models : A user model, and a product model. The product model has two user, one is the owner, and another is the borrower. The user model has many products, as owner, and as borrower.
Do you know if the code below is fulfilling my purpose ?
class User
has_many :products
end
class Product
belongs_to :owner, class_name: "User", foreign_key: "user_id"
has_one :borrower, class_name: "User", foreign_key: "user_id"
end