Skip to content

Conversation

@mtrudel
Copy link
Contributor

@mtrudel mtrudel commented Nov 24, 2020

The Resource class does not call through to Class#inherited. As a result the various ActiveSupport functions for interrogating a resource's subclasses (Resource.subclasses, Resource.descendents and the like) return empty result sets. This is because Resources override the inherited function but do not call through to their superclass. This PR adds the super call to enable this.

Fixes #1337

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.

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

@mtrudel
Copy link
Contributor Author

mtrudel commented Nov 27, 2020

Test failure seems to be isolated to a single CI matrix entry & looks unrelated to the changes in this PR - see https://travis-ci.org/github/cerebris/jsonapi-resources/jobs/745702545

@utilityboy
Copy link
Contributor

@lgebhardt, was there a specific reason why the call to super in this PR was excluded? We've tested on our fork and things appear to work as expected, but wanted to double-check in case there is any nuance we're missing. Many thanks!


class << self
def inherited(subclass)
super
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 this is really just a best practice. I don't think there's a test needed

@lgebhardt lgebhardt merged commit b680600 into cerebris:master Jan 8, 2021
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.

Resource#inherited class does not call through to Class#inherited

5 participants