提交 627f736c 编写于 作者: J Jon Moss

Fix `ActionController::Parameters#==` bug

See bug #21032.
上级 06397336
* Fix `ActionController::Parameters==`
*Jon Moss*
* Response etags to always be weak: Prefixes 'W/' to value returned by
`ActionDispatch::Http::Cache::Response#etag=`, such that etags set in
`fresh_when` and `stale?` are weak.
......
......@@ -160,7 +160,11 @@ def ==(other_hash)
if other_hash.respond_to?(:permitted?)
super
else
@parameters == other_hash
if other_hash.is_a?(Hash)
@parameters == other_hash.with_indifferent_access
else
@parameters == other_hash
end
end
end
......
......@@ -128,4 +128,10 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
assert_not @params.values_at(:person).first.permitted?
assert_not @params[:person].values_at(:name).first.permitted?
end
test "equality with another hash works" do
hash1 = { foo: :bar }
params1 = ActionController::Parameters.new(hash1)
assert(params1 == hash1)
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册