class PArticle < ApplicationRecord belongs_to :p_product_ref has_one :p_product, through: :p_product_ref belongs_to :p_product_color has_many :p_article_serial_nums, dependent: :destroy accepts_nested_attributes_for :p_article_serial_nums validates_presence_of :p_product_ref # has_many :p_product_ref_specs, through: :p_product_ref # accepts_nested_attributes_for :p_product_ref_specs acts_as_sorting :fields => { :id => {:name => "id", :reorder => true}, :p_product_ref_code => {:name => "Code ref", :reorder => true}, :p_product_ref => {:name => "Désignation", :reorder => true}, :color => {:name => "Couleur"}, :p_article_serial_nums => {:name => "N° identifiants"}, :actions => {:name => "Actions", :reorder => false}, } end