Skip to content

Commit c50b1c5

Browse files
committed
Rename resource_finder config option to default_resource_finder
1 parent 469d452 commit c50b1c5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/jsonapi/configuration.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Configuration
1717
:default_paginator,
1818
:default_page_size,
1919
:maximum_page_size,
20-
:resource_finder,
20+
:default_resource_finder,
2121
:default_processor_klass,
2222
:use_text_errors,
2323
:top_level_links_include_pagination,
@@ -109,7 +109,7 @@ def initialize
109109
# The default ResourceFinder is the ActiveRelationResourceFinder which provides
110110
# access to ActiveRelation backed models. Custom ResourceFinders can be specified
111111
# in order to support other ORMs.
112-
self.resource_finder = JSONAPI::ActiveRelationResourceFinder
112+
self.default_resource_finder = JSONAPI::ActiveRelationResourceFinder
113113

114114
# The default Operation Processor to use if one is not defined specifically
115115
# for a Resource.
@@ -225,8 +225,8 @@ def default_processor_klass=(default_processor_klass)
225225
@default_processor_klass = default_processor_klass
226226
end
227227

228-
def resource_finder=(resource_finder)
229-
@resource_finder = resource_finder
228+
def default_resource_finder=(default_resource_finder)
229+
@default_resource_finder = default_resource_finder
230230
end
231231

232232
def allow_include=(allow_include)

lib/jsonapi/resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def inherited(subclass)
423423

424424
check_reserved_resource_name(subclass._type, subclass.name)
425425

426-
subclass.include JSONAPI.configuration.resource_finder if JSONAPI.configuration.resource_finder
426+
subclass.include JSONAPI.configuration.default_resource_finder if JSONAPI.configuration.default_resource_finder
427427
end
428428

429429
# A ResourceFinder is a mixin that adds functionality to find Resources and Resource Fragments

test/fixtures/active_record.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ def find_breeds_by_keys(keys, options = {})
15571557
end
15581558
end
15591559

1560-
JSONAPI.configuration.resource_finder = BreedResourceFinder
1560+
JSONAPI.configuration.default_resource_finder = BreedResourceFinder
15611561
class BreedResource < JSONAPI::Resource
15621562
attribute :name, format: :title
15631563

@@ -1569,7 +1569,7 @@ def _save
15691569
return :accepted
15701570
end
15711571
end
1572-
JSONAPI.configuration.resource_finder = JSONAPI::ActiveRelationResourceFinder
1572+
JSONAPI.configuration.default_resource_finder = JSONAPI::ActiveRelationResourceFinder
15731573

15741574
class PlanetResource < JSONAPI::Resource
15751575
attribute :name

0 commit comments

Comments
 (0)