From c50b1c5f81e5ac8307c6b839d355106986ba656e Mon Sep 17 00:00:00 2001 From: Larry Gebhardt Date: Thu, 7 Mar 2019 09:50:47 -0500 Subject: [PATCH] Rename resource_finder config option to default_resource_finder --- lib/jsonapi/configuration.rb | 8 ++++---- lib/jsonapi/resource.rb | 2 +- test/fixtures/active_record.rb | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/jsonapi/configuration.rb b/lib/jsonapi/configuration.rb index acc30fef0..482b6e043 100644 --- a/lib/jsonapi/configuration.rb +++ b/lib/jsonapi/configuration.rb @@ -17,7 +17,7 @@ class Configuration :default_paginator, :default_page_size, :maximum_page_size, - :resource_finder, + :default_resource_finder, :default_processor_klass, :use_text_errors, :top_level_links_include_pagination, @@ -109,7 +109,7 @@ def initialize # The default ResourceFinder is the ActiveRelationResourceFinder which provides # access to ActiveRelation backed models. Custom ResourceFinders can be specified # in order to support other ORMs. - self.resource_finder = JSONAPI::ActiveRelationResourceFinder + self.default_resource_finder = JSONAPI::ActiveRelationResourceFinder # The default Operation Processor to use if one is not defined specifically # for a Resource. @@ -225,8 +225,8 @@ def default_processor_klass=(default_processor_klass) @default_processor_klass = default_processor_klass end - def resource_finder=(resource_finder) - @resource_finder = resource_finder + def default_resource_finder=(default_resource_finder) + @default_resource_finder = default_resource_finder end def allow_include=(allow_include) diff --git a/lib/jsonapi/resource.rb b/lib/jsonapi/resource.rb index dccc51241..1ad2760a9 100644 --- a/lib/jsonapi/resource.rb +++ b/lib/jsonapi/resource.rb @@ -423,7 +423,7 @@ def inherited(subclass) check_reserved_resource_name(subclass._type, subclass.name) - subclass.include JSONAPI.configuration.resource_finder if JSONAPI.configuration.resource_finder + subclass.include JSONAPI.configuration.default_resource_finder if JSONAPI.configuration.default_resource_finder end # A ResourceFinder is a mixin that adds functionality to find Resources and Resource Fragments diff --git a/test/fixtures/active_record.rb b/test/fixtures/active_record.rb index cbcd1a167..84fbcc702 100644 --- a/test/fixtures/active_record.rb +++ b/test/fixtures/active_record.rb @@ -1557,7 +1557,7 @@ def find_breeds_by_keys(keys, options = {}) end end -JSONAPI.configuration.resource_finder = BreedResourceFinder +JSONAPI.configuration.default_resource_finder = BreedResourceFinder class BreedResource < JSONAPI::Resource attribute :name, format: :title @@ -1569,7 +1569,7 @@ def _save return :accepted end end -JSONAPI.configuration.resource_finder = JSONAPI::ActiveRelationResourceFinder +JSONAPI.configuration.default_resource_finder = JSONAPI::ActiveRelationResourceFinder class PlanetResource < JSONAPI::Resource attribute :name