Commit 31df0e3c by ivan Lan

Skip snapshot remark_value if the key does not given

parent 927a05f4
......@@ -30,10 +30,12 @@ module Shotengai
private
def resource_params
remark_value = params.require(resource_key).fetch(:remark_value, {}).permit!
remark_value = params.require(resource_key).fetch(:remark_value, nil)&.permit!
params.require(resource_key).permit(
:revised_amount
).merge(remark_value: remark_value)
# WARNING: if .fetch(:remark_value, {}) get value {}
# it would update to this value
).merge(remark_value: remark_value || @resource.remark_value)
end
def rewrite_params
......
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