|
@@ -3,6 +3,7 @@ class Promotion < ActiveRecord::Base
|
|
|
self.table_name = "promotions"
|
|
self.table_name = "promotions"
|
|
|
validates :begin_time,:end_time,:name,:order_type, presence: true
|
|
validates :begin_time,:end_time,:name,:order_type, presence: true
|
|
|
has_and_belongs_to_many :depart_record
|
|
has_and_belongs_to_many :depart_record
|
|
|
|
|
+ has_and_belongs_to_many :products
|
|
|
|
|
|
|
|
def prodcut1
|
|
def prodcut1
|
|
|
prd1 = Product.where("id = ?", self.prod1).first
|
|
prd1 = Product.where("id = ?", self.prod1).first
|
|
@@ -159,6 +160,7 @@ class Promotion < ActiveRecord::Base
|
|
|
value.to_f / 100
|
|
value.to_f / 100
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
+ field :products
|
|
|
field :is_enable
|
|
field :is_enable
|
|
|
field :created_at
|
|
field :created_at
|
|
|
end
|
|
end
|
|
@@ -245,6 +247,7 @@ class Promotion < ActiveRecord::Base
|
|
|
field :send_nums5
|
|
field :send_nums5
|
|
|
field :cash
|
|
field :cash
|
|
|
field :cent
|
|
field :cent
|
|
|
|
|
+ field :products
|
|
|
field :is_enable
|
|
field :is_enable
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|