lib/jsonapi/routing_ext.rb in jsonapi-resources-0.10.7 vs lib/jsonapi/routing_ext.rb in jsonapi-resources-0.11.0.beta2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module ActionDispatch
module Routing
class Mapper
Resource.class_eval do
def unformat_route(route)
@@ -220,11 +222,11 @@
def jsonapi_related_resource(*relationship)
source = JSONAPI::Resource.resource_klass_for(resource_type_with_module_prefix)
options = relationship.extract_options!.dup
relationship_name = relationship.first
- relationship = source._relationships[relationship_name]
+ relationship = source._relationship(relationship_name)
relationship._routed = true
formatted_relationship_name = format_route(relationship.name)
@@ -244,10 +246,10 @@
def jsonapi_related_resources(*relationship)
source = JSONAPI::Resource.resource_klass_for(resource_type_with_module_prefix)
options = relationship.extract_options!.dup
relationship_name = relationship.first
- relationship = source._relationships[relationship_name]
+ relationship = source._relationship(relationship_name)
relationship._routed = true
formatted_relationship_name = format_route(relationship.name)
related_resource = JSONAPI::Resource.resource_klass_for(resource_type_with_module_prefix(relationship.class_name.underscore))