Skip to content

Allow setting of the resource finder on a per resource basis#1230

Closed
lgebhardt wants to merge 2 commits intomasterfrom
set_resource_finder
Closed

Allow setting of the resource finder on a per resource basis#1230
lgebhardt wants to merge 2 commits intomasterfrom
set_resource_finder

Conversation

@lgebhardt
Copy link
Copy Markdown
Contributor

This gets us closer to supporting alternate resource finders. This should work with multiple resource finders as long as relationships do not span the different data stores.

I wanted to keep the resource finders as mix-ins to allow existing code to override the records and other methods. In order to support a default resource finder and allow setting this with a method in the resource class definition the mix-in needed to delay loading. This was accomplished with method_missing to load the resource finder if it isn't loaded.

All Submissions:

  • I've checked to ensure there aren't other open Pull Requests for the same update/change.
  • I've submitted a ticket for my issue if one did not already exist.
  • My submission passes all tests. (Please run the full test suite locally to cut down on noise from travis failures.)
  • I've used Github auto-closing keywords in the commit message or the description.
  • I've added/updated tests for this change.

New Feature Submissions:

  • I've submitted an issue that describes this feature, and received the go ahead from the maintainers.
  • My submission includes new tests.
  • My submission maintains compliance with JSON:API.

Bug fixes and Changes to Core Features:

  • I've included an explanation of what the changes do and why I'd like you to include them.
  • I've provided test(s) that fails without the change.

Test Plan:

Reviewer Checklist:

  • Maintains compliance with JSON:API
  • Adequate test coverage exists to prevent regressions

Comment thread lib/jsonapi/resource.rb Outdated
Comment thread lib/jsonapi/resource.rb Outdated
Comment thread lib/jsonapi/resource.rb Outdated
@lgebhardt lgebhardt force-pushed the set_resource_finder branch from 94b3a5e to 4ff090e Compare March 14, 2019 19:39
Comment thread lib/jsonapi/resource.rb Outdated
Loads resource finder when found to be missing. This delayed loading
enables the resource to set a resource finder that is used in place of
the default.

Removes the abstract methods from resource. These may vary based on the
processor.
@lgebhardt lgebhardt force-pushed the set_resource_finder branch from 4ff090e to fd5f18b Compare March 14, 2019 20:01
@lgebhardt lgebhardt closed this in 013d090 Mar 15, 2019
@lgebhardt lgebhardt deleted the set_resource_finder branch March 15, 2019 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants