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

Accessing single related resource #90

Closed
mkamensky opened this issue Jan 27, 2018 · 4 comments
Closed

Accessing single related resource #90

mkamensky opened this issue Jan 27, 2018 · 4 comments

Comments

@mkamensky
Copy link

Hi,

I am getting an error message when trying to access a has_one resource, as in

/foos/7/bar

where a Foo has one Bar. I traced the problem to this line:

related_resource = source_resource.public_send(relationship_type)

It appears that the resource class does not define an accessor in this case (i.e., the Foo resource does not have bar method). But maybe I'm doing something wrong?

Thanks
Moshe

@valscion
Copy link
Member

Hi! Thanks for opening an issue ☺️

I'm afraid I'm going to need more details on how your resources and models look like. The dummy application this gem uses in the specs does test for a has_one relationship, so that should work: https://github.com/venuu/jsonapi-authorization/blob/v1.0.0.alpha6/spec/dummy/app/resources/comment_resource.rb

@mkamensky
Copy link
Author

Thanks @valscion. So it appears that the difference is that I am using the git version of JR, rather than 0.9. As far as I can see, with the git version, the dummy app fails as well (I'm not sure how one is supposed to run it, none of the policy methods are defined...) I can't figure out what exactly has changed in JR, or why.

@mkamensky
Copy link
Author

Ok, I think this is a duplicate of #82

@valscion
Copy link
Member

valscion commented Jan 29, 2018

Ok yeah. We don't yet support the upcoming 0.10 version of JR so I'll close this as a duplicate of #64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants