3 ms·
Just to expand on what others have already said...Rails converts params to http://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html http:
by mnarayan01 14y ago
Just to expand on what others have already said...Rails converts params to http://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html http://api.rubyonrails.org/classes/ActiveSupport/HashWithInd... which means that `params[:foo]` and `params["foo"]` will both return the same thing. The function [`assert_valid_keys`](http://api.rubyonrails.org/classes/Hash.html#method-i-assert_valid_keys http://api.rubyonrails.org/classes/Hash.html#method-i-assert...), which is called in [`apply_finder_options`](http://api.rubyonrails.org/classes/ActiveRecord/SpawnMethods.html#method-i-apply_finder_options http://api.rubyonrails.org/classes/ActiveRecord/SpawnMethods...) does not, however, treat symbol and string keys as the same, even if given a `HashWithIndifferentAccess`.
- xentronium 14y agoTo expand on your expansion: when a hash with indifferent access is asserted over a list of symbols (as is the keys) it will always fail. 1.9.3p327 :025 > {:a => "b"}.with_indifferent_access.assert_valid_keys([:a]) ArgumentError: Unknown key: a