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

Swagger throwing undefined method `collect' for nil:NilClass #197

Open
craigulliott opened this issue Apr 25, 2015 · 1 comment
Open

Swagger throwing undefined method `collect' for nil:NilClass #197

craigulliott opened this issue Apr 25, 2015 · 1 comment

Comments

@craigulliott
Copy link
Contributor

it appears grape-swagger doesn't support grapes use of the route_param block

This code works fine.

 desc 'Delete a question'
 params do
   requires :id, desc: 'ID of the question'
 end
 delete ':id' do
   Question.find(params[:id]).delete
   { success: true }
 end

This code below throws an error.

route_param :id do
   delete do
     Question.find(params[:id]).delete
     { success: true }
   end
 end

I'm logging this as an issue because the way we use Napa at Belly and the official grape examples result in this error. And it took me several hours to figure out what the cause was. Hopefully this helps someone else.

@ianneub
Copy link
Contributor

ianneub commented May 11, 2015

I think this is also related to #203 I was getting this same error, until I forced grape-swagger to ~> 0.9.0

gem 'grape-swagger', '~> 0.9.0'

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

2 participants