Skip to content

Commit 7ba9284

Browse files
committed
Allow ActionController::Params as the data root
With Rails 5 `ActionController::Params` no longer inherits from `Hash`. This fixes the JSON API endpoint compatibility to support any "hash" data root.
1 parent 540b90f commit 7ba9284

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/kracken/controllers/json_api_compatible.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def in_transaction
177177
# If the data was a Hash, then the single `permit_params` object is returned.
178178
# Or the tuple [`id`, `permitd_params`] respectively.
179179
def process_params(permitted_params)
180-
single_resource = Hash === data_root
180+
single_resource = data_root.respond_to?(:to_hash)
181181
data = Array.wrap(data_root)
182182
mapping = if params[:id].blank?
183183
data.map { |attrs| attrs.permit(permitted_params) }

0 commit comments

Comments
 (0)