Commit 3369bc3d by ivan Lan

Fix editing about spec_rewrite

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