Skip to content

Commit 69e9d5d

Browse files
Adding with_indiferent_access to controller params
In Rails 4.2, `to_unsafe_hash` converts the `params` to a Hash and the values can only be accessed with the keys as strings. This change allows for compatibility with Rails 4.2.
1 parent 14a9421 commit 69e9d5d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/jsonapi/rails/controller/deserialization.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def deserializable_resource(key, options = {}, &block)
4949
Class.new(JSONAPI::Rails::DeserializableResource, &block)
5050

5151
before_action(options) do |controller|
52-
hash = controller.params.to_unsafe_hash[:_jsonapi]
52+
hash = controller.params.to_unsafe_hash
53+
.with_indifferent_access[:_jsonapi]
5354
if hash.nil?
5455
JSONAPI::Rails.logger.warn do
5556
"Unable to deserialize #{key} because no JSON API payload was" \

0 commit comments

Comments
 (0)