chętne obciążenie polimorficzne szyny
You need to add a custom belongs_to to your polymorphic model
class Shipment
has_many :payments, as: :paymentable
end
class Payment
belongs_to :paymentable, polymorphic: true
# Add a custom belongs_to that points to Shipment
belongs_to :shipment, foreign_type: 'Shipment', foreign_key: 'paymentable_id'
end
Mo Lucas