Skip to content

Commit d9b13d2

Browse files
authored
Merge pull request #36 from RadiusNetworks/fix-single-resource-in-api
Allow `ActionController::Params` as the data root
2 parents 50355ce + 7ba9284 commit d9b13d2

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
@@ -176,7 +176,7 @@ def in_transaction
176176
# If the data was a Hash, then the single `permit_params` object is returned.
177177
# Or the tuple [`id`, `permitd_params`] respectively.
178178
def process_params(permitted_params)
179-
single_resource = Hash === data_root
179+
single_resource = data_root.respond_to?(:to_hash)
180180
data = Array.wrap(data_root)
181181
mapping = if params[:id].blank?
182182
data.map { |attrs| attrs.permit(permitted_params) }

0 commit comments

Comments
 (0)