Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to render STI classes gives a cryptic error #113

Open
faissalMT opened this issue Oct 10, 2019 · 0 comments
Open

Trying to render STI classes gives a cryptic error #113

faissalMT opened this issue Oct 10, 2019 · 0 comments

Comments

@faissalMT
Copy link

faissalMT commented Oct 10, 2019

Something similar was briefly mentioned here:
#68 (comment)
When a relation contains an item of an STI type jsonapi-rails isn't able to infer the renderer for it and instead it only crashes with the error:

ActiveModel::UnknownAttributeError:
       unknown attribute 'url_helpers' for PrimarySubject.

At the very least a helpful error message would go a long way here, as this is difficult to debug yourself.
The workaround is to manually specify all classes:

{
          Subject: SerializableSubject,
          PrimarySubject: SerializableSubject
          SecondarySubject: SerializableSubject
          ModernLanguagesSubject: SerializableSubject,
          FurtherEducationSubject: SerializableSubject
}
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

No branches or pull requests

1 participant