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

explicit "namespace" necessary at top of files mounted to a resource location #161

Closed
clifton opened this issue Apr 12, 2012 · 3 comments
Closed

Comments

@clifton
Copy link

clifton commented Apr 12, 2012

class Users < Grape::API
  get '/' do
    User.all
  end
end

class API < Grape::API
  mount Users => "/users"
end

Calling /users results in a 404. This is circumvented by adding another explicit namespace at the top of Users. Should this be necessary?

@jch
Copy link
Contributor

jch commented Apr 12, 2012

I reproduced this locally, but I don't think the extra namespace should be necessary. api.rb's mount method does keep track of the path, but I didn't follow further to see how the route matching is done when a path is set. If you come up with a fix for this, I can look it over and merge it.

@clifton
Copy link
Author

clifton commented Apr 12, 2012

Thanks for the quick reply. Yeah, it's probably worth making a pull request for it. I guess the pull request would modify API#mount to set the namespace inside of the mounted class, but that's just from glancing at the source.

@dblock
Copy link
Member

dblock commented Jan 5, 2013

This is a dup of #60. Setting the namespace could be a solution. There's a small spec that demonstrates this failure in that issue, too.

@dblock dblock closed this as completed Jan 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants