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
Jorge Cruz
19,305 PointsStuck on Code Challenge: URL Options
On task 2 of 3 of the code challenge: http://teamtreehouse.com/library/advanced-social-features-in-ruby-on-rails/create-an-image-gallery/url-options I enter the following code:
def url_options
{ profile_name: params[:profile_name] }
end
I think it is the right answer, but it can't complete it. All I get is the message: Bummer! The url_options method was not defined. {:profile_name=>nil} true
What might I be doing wrong?
2 Answers
Jorge Cruz
19,305 PointsThanks for responding, but I figured it out. The params[:profile_name] does not have a value in this exercise, but the current_user variable does ...
def url_options
{profile_name: current_user.profile_name}
end
That merge method is the solution for part 3 of the code challenge.
Ivan Dimitrov
10,587 PointsI think you just need to add .merge(super) on the second line.
def url_options
{ profile_name: params[:profile_name] }.merge(super)
end
Ivan Dimitrov
10,587 PointsIvan Dimitrov
10,587 Pointsgood that you found it, sorry if I confused you
Eric Breuers
Courses Plus Student 19,270 PointsEric Breuers
Courses Plus Student 19,270 PointsNice, thanks for posting the solution Jorge Cruz I was stuck on this too.