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
Julian Hurley
3,133 PointsWhy delete the :user_id from the :status hash on updated of a status?
This part of the video completely lost me:
if params[:status] && params.has_key?(:user_id)
params[:status].delete(:user_id)
end
Why are you bothering to delete the user_id? Is it because it already exists in the resource and so you want to make the system more efficient?
Also, I thought the params hash was for retrieving data in the URI. How is it getting populated by my actions?
1 Answer
John Paul Ashenfelter
1,118 PointsNot sure exactly which video you're talking about, but the params hash in Rails is automatically populated with the form/url parameters in the request.