lib/jsonapi/resource_serializer.rb in jsonapi-resources-0.4.3 vs lib/jsonapi/resource_serializer.rb in jsonapi-resources-0.4.4

- old
+ new

@@ -20,11 +20,10 @@ @include = options.fetch(:include, []) @include_directives = options[:include_directives] @key_formatter = options.fetch(:key_formatter, JSONAPI.configuration.key_formatter) @route_formatter = options.fetch(:route_formatter, JSONAPI.configuration.route_formatter) @base_url = options.fetch(:base_url, '') - @scope_id = options[:scope_id] end # Converts a single resource, or an array of resources to a hash, conforming to the JSONAPI structure def serialize_to_hash(source) is_resource_collection = source.respond_to?(:to_ary) @@ -205,15 +204,10 @@ def formatted_module_path(source) formatted_module_path_from_klass(source.class) end def formatted_module_path_from_klass(klass) - if klass.name =~ /::[^:]+\Z/ - path = (@route_formatter.format($`).freeze.gsub('::', '/') + '/').downcase - @scope_id ? "#{path}#{@scope_id}/" : path - else - '' - end + klass.name =~ /::[^:]+\Z/ ? (@route_formatter.format($`).freeze.gsub('::', '/') + '/').downcase : '' end def self_href(source) "#{@base_url}/#{formatted_module_path(source)}#{@route_formatter.format(source.class._type.to_s)}/#{source.id}" end