@@ -286,7 +286,7 @@ def parse_params(params, allowed_fields)
286286 end
287287
288288 unless links_object [ :id ] . nil?
289- association_resource = Resource . resource_for ( @resource_klass . module_path + links_object [ :type ] )
289+ association_resource = Resource . resource_for ( @resource_klass . module_path + unformat_key ( links_object [ :type ] ) . to_s )
290290 checked_has_one_associations [ param ] = association_resource . verify_key ( links_object [ :id ] , @context )
291291 else
292292 checked_has_one_associations [ param ] = nil
@@ -309,12 +309,12 @@ def parse_params(params, allowed_fields)
309309 if links_object . length == 0
310310 checked_has_many_associations [ param ] = [ ]
311311 else
312- if links_object . length > 1 || !links_object . has_key? ( association . type . to_s )
312+ if links_object . length > 1 || !links_object . has_key? ( format_key ( association . type ) )
313313 raise JSONAPI ::Exceptions ::TypeMismatch . new ( links_object [ :type ] )
314314 end
315315
316316 links_object . each_pair do |type , keys |
317- association_resource = Resource . resource_for ( @resource_klass . module_path + type )
317+ association_resource = Resource . resource_for ( @resource_klass . module_path + unformat_key ( type ) . to_s )
318318 checked_has_many_associations [ param ] = association_resource . verify_keys ( keys , @context )
319319 end
320320 end
@@ -400,7 +400,7 @@ def parse_single_replace_operation(data, keys)
400400 end
401401
402402 type = data [ :type ]
403- if type . nil? || type != @resource_klass . _type . to_s
403+ if type . nil? || type != format_key ( @resource_klass . _type ) . to_s
404404 raise JSONAPI ::Exceptions ::ParameterMissing . new ( :type )
405405 end
406406
0 commit comments