2020-07-30 12:06:39 +02:00

61 lines
1.8 KiB
Ruby

class MOdr < ApplicationRecord
belongs_to :p_customer
has_many :import_csvs
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 :mail_type_cats, :dependent => :destroy
has_many :m_odr_product_remises, :through => :m_odr_products
has_many :m_odr_reps, :dependent => :destroy
has_many :m_odr_coupons
end