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
Strong params, curl and Rails 5 API #211
Comments
@ralphking I had the same thing, and am happy to add my patch back to master. |
Hmm I was thinking of doing the same - just saw in the Docs that nobrainer should play nicely with Rails 5 so wasn't sure if it was a bug or not |
I think it's unexpected, I'll file a PR now. |
Ok I'll just borrow your fork for now while I test. Thanks |
@ralphking there's some other things inside |
@ralphking I've created a new branch that you can check. The implementation is a little different (it's now really backwards compatible). |
@ralphking, I've pushed @jeroenvisser101 fix on master. Does it fixes your issue? |
@nviennot thanks for merging :) |
Hi,
I'm falling foul of the assign_params method, here: https://github.com/nviennot/nobrainer/blob/master/lib/no_brainer/document/attributes.rb#L73
Using Rails 5 RC1.
Model:
Controller:
All very standard. When using curl to test the api, I'm hitting the error inside assign_attributes. I have the attributes in the controller, whitelisted.
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"venue":{"name":"test","desc":"something"}}' http://localhost:3000/venues
It works fine if I pass them as a hash, which is what the error is checking for:
@venue = Venue.new(name: params[:name], desc: params[:desc])
I assume it's doing this because it thinks I'm trying to submit attributes that are not whitelisted. Is this a bug?
Thanks
The text was updated successfully, but these errors were encountered: