Reputation: 10673
I'm using the rails-api gem and trying to use curl to POST some data to the API (to populate the Campaigns entity). This model only has one attribute name.
My curl request:
curl -d "name=Facebook" http://localhost:3000/campaigns/
The name attribute ends up being null looking at the json response. I then changed it to this:
curl -d "campaign[name]=Facebook" http://localhost:3000/campaigns/
This just seems to render some HTML in the terminal. Looking at the HTML there is a message on the lines of forbidden_attributes_protection.
Can anyone help?
Upvotes: 2
Views: 596
Reputation: 2341
Try adding in your
params.require(:compaign).permit(:name)
This looks like a strong parameters error. http://edgeapi.rubyonrails.org/classes/ActionController/StrongParameters.html
Upvotes: 1