Commit fef8cd60 by ivan Lan

Improve create snapshot

parent d689a88c
...@@ -28,8 +28,7 @@ module Shotengai ...@@ -28,8 +28,7 @@ module Shotengai
# 不指定 order 时,默认创建在 cart 中 # 不指定 order 时,默认创建在 cart 中
# TODO: WARNING: snapshots # TODO: WARNING: snapshots
def create def create
order_or_cart = Shotengai::Order.find_by_id(params[:order_id]) || @buyer.order_cart @resource = default_resources.create!(resource_params)
@resource = order_or_cart.product_snapshots.create!(resource_params)
respond_with @resource, template: "#{@@template_dir}/show", status: 201 respond_with @resource, template: "#{@@template_dir}/show", status: 201
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment