sadem_app/app/models/m_odr.rb
Nicolas Bally d4c76bafa8 suite
2020-07-03 10:19:55 +02:00

59 lines
1.7 KiB
Ruby

class MOdr < ApplicationRecord
belongs_to :p_customer
belongs_to :background_image_file , :class_name => "ImageFile"
belongs_to :banner_image_file, :class_name => "ImageFile"
belongs_to :logo_image_file, :class_name => "ImageFile"
belongs_to :social_image_file, :class_name => "ImageFile"
belongs_to :footer_image_file, :class_name => "ImageFile"
belongs_to :ba_image_file, :class_name => "ImageFile"
validates :p_customer, :presence => true
validates :name, :presence => true
validates :slug, :presence => true
validates :start_at, :presence => true
validates :end_at, :presence => true
validates :public_end, :presence => true
has_many :m_odr_file_types, :dependent => :destroy
accepts_nested_attributes_for :m_odr_file_types, :allow_destroy => true
has_many :m_odr_brands, :dependent => :destroy
accepts_nested_attributes_for :m_odr_brands, :allow_destroy => true
has_many :m_odr_products, :dependent => :destroy
accepts_nested_attributes_for :m_odr_products, :allow_destroy => true
has_many :m_odr_product_cats, :dependent => :destroy
accepts_nested_attributes_for :m_odr_product_cats, :allow_destroy => true
has_many :m_odr_places, :dependent => :destroy
accepts_nested_attributes_for :m_odr_places, :allow_destroy => true
has_many :m_odr_trackers, :dependent => :destroy
accepts_nested_attributes_for :m_odr_trackers, :allow_destroy => true
has_many :mail_types, :dependent => :destroy
accepts_nested_attributes_for :mail_types, :allow_destroy => true
has_many :m_odr_product_remises, :through => :m_odr_products
has_many :m_odr_reps, :dependent => :destroy
has_many :m_odr_coupons
end