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

Get method doesn't use existing resource #28

Closed
ryanmk54 opened this issue May 3, 2019 · 7 comments
Closed

Get method doesn't use existing resource #28

ryanmk54 opened this issue May 3, 2019 · 7 comments
Assignees
Labels

Comments

@ryanmk54
Copy link
Contributor

ryanmk54 commented May 3, 2019

I have the route current_sbm_employees_path | GET | /merchandising/sbm_employees/current(.:format)
I tried to access it with api.resource('sbm_employees').get('current')
but that gives me /merchandising/current
It works correctly if I use api.resource('sbm_employees').list('current')

Based on the documentation it appears that accessing the url with the get method should work too.

@victor-am
Copy link
Owner

Hey @ryanmk54 sorry for the delay (I got sick over the weekend 🤒)
This is indeed a problem, gonna work on this later this week 👍

But I guess it all started because you have a singular resource in current which isn't yet supported and being so using the list function seemed weird.

I guess this is one more reason to figure out some way to work with singular resources 🤔

@victor-am victor-am self-assigned this May 7, 2019
@victor-am victor-am added the bug label May 7, 2019
@victor-am victor-am changed the title get method doesn't use existing resource Get method doesn't use existing resource May 7, 2019
victor-am added a commit that referenced this issue May 16, 2019
This was done to take advantage from the namespace features, that way if
you do `api.namespace('users').get('profile')` it will work as expected.

Fixes issue #28
@victor-am
Copy link
Owner

Sorry about the delay, it should be fixed on #30
Can you check if this solves your problem?

I will probably be merging it and releasing a new version next week 👍

@ryanmk54
Copy link
Contributor Author

I don't think it fixed it. I still get the same url as before.

@victor-am
Copy link
Owner

victor-am commented May 20, 2019

Weird 🤔
Gonna check it out later.
Just to be sure though: did you use the version of the code inside the #30 pull request? 🤔

@ryanmk54
Copy link
Contributor Author

I changed

package.json to

"rails-ranger": "victor-am/rails-ranger#vam-move-raw-requests-to-route-builder",

which resulted in the following yarn.lock entry after yarn install

rails-ranger@victor-am/rails-ranger#vam-move-raw-requests-to-route-builder:
  version "1.1.2"
  resolved "https://codeload.github.com/victor-am/rails-ranger/tar.gz/ec6f9f0dc09dbc3cd06b4e64e0395a49da88105b"
  dependencies:
    axios "^0.18.0"
    humps "^2.0.1"
    lodash "^4.17.10"
    qs "^6.5.0"

Using api.resource('sbm_employees').get('current') results in /merchandising/current

@victor-am
Copy link
Owner

So I investigated and my bad, I forgot to warn that just pointing to my PR would still load the old version because my PR didn't re-build the dist files 🤦‍♂

But I did the test with a personal project and seems to be working fine with the new code 😄

So I just published v1.1.3, try upgrading the library in your app and the problem should be fixed 🎉

@ryanmk54
Copy link
Contributor Author

Awesome! Thanks. It worked.

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

No branches or pull requests

2 participants