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 trial

Ruby User Authentication with Rails Adding User Support to Our Application Scoping Todo Lists

todo_list_params

Hi,

I wanna know why your are not updating the todo_list_params function to add user_id, is not necessary in this particular case?

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

We don't need to change the todo_list_params function because the user_id is never passed as a parameter (the HTML form was never touched to send an extra parameter). The user_id is set through the session controller, which is mediated through cookies behind the scenes. Scoping todo_list through current_user is what sets the user_id to the currently logged in user.