mmsc_app/app/models/m_odr_product.rb
Nicolas Bally f1b114f7e4 suite
2020-06-11 07:59:21 +02:00

33 lines
597 B
Ruby

class MOdrProduct < ApplicationRecord
belongs_to :m_odr_brand
belongs_to :m_odr
has_many :m_odr_product_sizes
has_many :m_odr_product_remises, :dependent => :destroy
accepts_nested_attributes_for :m_odr_product_remises, :allow_destroy => true
acts_as_sorting :fields => {
:id => {:name => "Id", :reorder => true},
:name => {:name => "Nom"},
:actions => {:name => "Actions", :reorder => true},
}
def member_label
if self.m_odr_brand
"#{self.m_odr_brand.name} - #{self.name}"
else
self.name
end
end
end