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
Daniel Meusburger
2,200 Points(Help) Delete the params[:status] hash if it exists in the params hash.
Hello, I am currently learning RubyOnRails and I am not that experienced with programming. The headline is one of the "Code Challenge: More Parameter Modification" tasks and I just don't know what I am missing.
my answer so far: params[:status].delete(:user_id) if params[:status].has_key?(:user_id) and params[:status].delete(:status) if params[:status].has_key?(:status)
Would be grateful for a solution, everything else worked out fine so far :-)
5 Answers
Moiz Malik
11,906 Pointsparams.delete(:status) if params[:status]
Jason Seifer
Treehouse Guest TeacherGreat answer, Moiz!
Roland van Paridon
1,204 PointsThanks! I was also struggling with this one.
David Blayney
4,290 PointsThat code can also be changed to...
if params[:status]
params.delete(:status)
end
to make it a bit easier to read
Abdullah Al-Mamun
2,326 Points:D I was also doing this except the end keyword at the end
Dan Perata
7,352 PointsI was stuck because I didn't use the () or [] appropriately. Where is some information on how they are different and what they mean?
Kristopher Kerr
4,457 PointsI was confused as well. http://www.addedbytes.com/cheat-sheets/ruby-on-rails-cheat-sheet/