|
|
@@ -7,22 +7,12 @@ class OrderDetail < ActiveRecord::Base
|
|
|
# has_one :order, :foreign_key=>:order_id, :primary_key=>:order_id
|
|
|
validates :order_no,:product_id,:nums, presence: true
|
|
|
validate :order_validation
|
|
|
- after_create :import_orders
|
|
|
- def before_import_save(record)
|
|
|
- pd = Product.where("id = ?", record[:product_id]).first
|
|
|
- pd = Product.where("id = ?", record[:product_id]).first
|
|
|
- pd = Product.where("id = ?", record[:product_id]).first
|
|
|
- pd = Product.where("id = ?", record[:product_id]).first
|
|
|
- end
|
|
|
+ #after_create :import_orders
|
|
|
+ # def before_import_save(record)
|
|
|
+ # end
|
|
|
def after_import_save(record)
|
|
|
- od = Order.where("id = ?", record[:product_id]).first
|
|
|
- od = Order.where("id = ?",record[:product_id]).first
|
|
|
- od = Order.where("id = ?", record[:product_id]).first
|
|
|
- od = Order.where("id = ?", record[:product_id]).first
|
|
|
- end
|
|
|
- def import_orders
|
|
|
# 获取商品信息
|
|
|
- pd = Product.where("id = ?", self.product_id).first
|
|
|
+ pd = Product.where("id = ?", record[:product_id]).first
|
|
|
detail = OrderDetail.where("id = ?", self.id).first
|
|
|
od = Order.where("order_id = ?", self.order_no).first
|
|
|
|
|
|
@@ -58,8 +48,8 @@ class OrderDetail < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
end
|
|
|
+ end
|
|
|
|
|
|
- end
|
|
|
|
|
|
|
|
|
end
|