This repository has been archived on 2021-11-24. You can view files and clone it, but cannot push or open issues or pull requests.
phone_app/app/models/p_article.rb
2021-08-27 19:43:54 +02:00

25 lines
942 B
Ruby

class PArticle < ApplicationRecord
belongs_to :p_grade
belongs_to :p_product_ref
has_one :p_product, through: :p_product_ref
has_one :p_product_color, through: :p_product_ref
has_many :p_article_serial_nums, dependent: :destroy
has_many :p_serial_num_values, through: :p_article_serial_nums
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},
:p_grade => {:name => "Grade", :reorder => true},
:color => {:name => "Couleur"},
:p_article_serial_nums => {:name => "N° identifiants"},
:actions => {:name => "Actions", :reorder => false},
}
end