Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialRyan Drake
12,587 PointsBUG: Coding the API (Building a Rails API) Video Series
Hi all,
Just wanted to list this here in case anyone else gets stuck like me!
I found a bug in this video series. Specifically, the video "Coding the API: Rails API CSRF Verification".
In the video, you're asked to write a private method:
def list_params
params.require('todo_list').permit("title")
end
However, if you've been following on from the previous "Building a To Do App in Rails 4", we actually have both 'title' and 'description' as required attributes. So if you follow the video and get a 500 error using the cURL:
curl -i -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"title":"Title Here"}' http://localhost:3000/api/todo_lists
You need to modify your private method to:
def list_params
params.require('todo_list').permit(:title, :description)
end
And alter your cURL to pass through a 'description' parameter as well:
curl -i -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"title":"Title Here", "description":"Description here"}' http://localhost:3000/api/todo_lists
Hopefully that helps some of you get unstuck!