Commit 3369bc3d by ivan Lan

Fix editing about spec_rewrite

parent 13bf393f
...@@ -22,8 +22,8 @@ module Shotengai ...@@ -22,8 +22,8 @@ module Shotengai
def update def update
@resource.class.transaction do @resource.class.transaction do
@resource.attributes = resource_params @resource.attributes = resource_params
@resource.has_changes_to_save? && edit_only_unpaid @resource.has_changes_to_save? && edit_only_unpaid && @resource.save!
@resource.update_columns(rewrite_params.to_h) # skip validation @resource.update_columns(rewrite_params.to_h) if rewrite_params.present? # skip validation
end end
head 200 head 200
end end
...@@ -41,7 +41,7 @@ module Shotengai ...@@ -41,7 +41,7 @@ module Shotengai
end end
def edit_only_unpaid def edit_only_unpaid
raise Shotengai::WebError.new('订单已支付,不可修改该快照。', '-1', 403) unless @resource.order.unpaid? @resource.order.unpaid? || raise(Shotengai::WebError.new('订单已支付,不可修改该快照。', '-1', 403))
end end
def manager_auth def manager_auth
......
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