31 lines
624 B
Ruby
31 lines
624 B
Ruby
class MOdrProduct < ApplicationRecord
|
|
belongs_to :m_odr_brand
|
|
|
|
belongs_to :m_odr
|
|
|
|
has_many :m_odr_product_remises, :dependent => :destroy
|
|
accepts_nested_attributes_for :m_odr_product_remises, :allow_destroy => true
|
|
|
|
acts_as_sorting :fields => {
|
|
:name => {:name => "Nom", :reorder => true},
|
|
:m_odr_brand => {:name => "Marque", :reorder => true},
|
|
:m_odr_product_remises => {:name => "Remises"},
|
|
|
|
:actions => "Actions"
|
|
}
|
|
|
|
|
|
|
|
def member_label
|
|
if self.m_odr_brand
|
|
"#{self.m_odr_brand.name} - #{self.name}"
|
|
|
|
else
|
|
self.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|