From 8f120baa3fc7458cfa0f45a9ccef23c73c9c0b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A9?= Date: Tue, 7 Sep 2021 19:10:21 +0200 Subject: [PATCH] price_line_resp_select relations --- app/models/price_line.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/price_line.rb b/app/models/price_line.rb index 1dabff0..0eba34d 100644 --- a/app/models/price_line.rb +++ b/app/models/price_line.rb @@ -3,6 +3,12 @@ class PriceLine < ApplicationRecord belongs_to :p_product belongs_to :p_product_ref belongs_to :p_product_power + has_many :price_line_resp_selects, :foreign_key => :price_line_demand + has_many :price_line_resps, through: :price_line_resp_selects, :source => :price_line_resp + + + #has_many :price_line_demands, through: :price_line_resp_selects + default_scope { order('position ASC') } validates :p_product_ref_id, :presence => true, :if => :p_product_ref_needed?