From 2b94a63441ca91cbe5f1dc5e21f1b8a581d99c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czy=C5=BC?= Date: Fri, 22 Sep 2017 23:38:18 +0200 Subject: [PATCH 1/2] naive solution for #1120 --- lib/jsonapi/routing_ext.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jsonapi/routing_ext.rb b/lib/jsonapi/routing_ext.rb index 34e9d6ff7..c2d226c35 100644 --- a/lib/jsonapi/routing_ext.rb +++ b/lib/jsonapi/routing_ext.rb @@ -255,8 +255,12 @@ def jsonapi_resource_scope(resource, resource_type) #:nodoc: private def resource_type_with_module_prefix(resource = nil) - resource_name = resource || @scope[:jsonapi_resource] - [@scope[:module], resource_name].compact.collect(&:to_s).join('/') + if (resource && resource[0] == '/')¬ + resource¬ + else¬ + resource_name = resource || @scope[:jsonapi_resource] + [@scope[:module], resource_name].compact.collect(&:to_s).join('/') + end end end end From be75ce5981dde61cd937fda594b9b7015effae6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czy=C5=BC?= Date: Sat, 23 Sep 2017 01:54:11 +0200 Subject: [PATCH 2/2] whitespace cleanup --- lib/jsonapi/routing_ext.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jsonapi/routing_ext.rb b/lib/jsonapi/routing_ext.rb index c2d226c35..16327d41b 100644 --- a/lib/jsonapi/routing_ext.rb +++ b/lib/jsonapi/routing_ext.rb @@ -255,9 +255,9 @@ def jsonapi_resource_scope(resource, resource_type) #:nodoc: private def resource_type_with_module_prefix(resource = nil) - if (resource && resource[0] == '/')¬ - resource¬ - else¬ + if (resource && resource[0] == '/') + resource + else resource_name = resource || @scope[:jsonapi_resource] [@scope[:module], resource_name].compact.collect(&:to_s).join('/') end