class User < ApplicationRecord has_many :products, foreign_key: "owner_id", inverse_of: :owner end class Product < ApplicationRecord belongs_to :owner, class_name: "User", foreign_key: "owner_id" end```