sadem_app/app/models/m_odr.rb
Nicolas Bally 2e982b4fd2 suite
2020-02-27 13:51:18 +01:00

48 lines
1.4 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"
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_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_reps, :dependent => :destroy
end