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 Building Web Apps with Sinatra ERB Templates URL Parameters

Hey there! not sure where I am going wrong, I tried to return the string with the key value, however no luck.

In the get route for the "/greet/:name" path, respond with a string reading "Hello" followed by the contents of the name URL parameter.

hello.rb
require "sinatra"

get "/greet/:name" do
    params[:name]
  "Hello, #{:name}

end


#"Hello," 
 # page_content(params[:name])

1 Answer

Hi Carlos,

All of the code you need is already there. There appears to be a lot of extra code that is not needed for the challenge though.

The challenge asks for a string and the name URL parameter. Simply close your string and don't forget to concantenate two items. Like so:

require "sinatra"

get "/greet/:name" do
  "Hello," + params[:name]

end

Cheers!