class PArticleSerialNum < ApplicationRecord
  belongs_to :p_article
  belongs_to :p_serial_num_type
  belongs_to :p_serial_num_value, inverse_of: :p_article_serial_nums
  has_one :p_product_ref, through: :p_article
  # accepts_nested_attributes_for :p_serial_num_value

  acts_as_sorting :fields => {
      :id => {:name => "ID"},
      :p_article => {:name => "Article", :reorder => true},
      :p_article_id => {:name => "Article ID", :reorder => true},
      :p_serial_num_type => {:name => "Type", :reorder => true},
      :value => {:name => "N°", :reorder => true},

      :actions => {:name => "Actions", :reorder => true}

    }

end
