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

Peter Buckwalter
Peter Buckwalter
6,846 Points

Redirects to Google

Hello,

I am working on the building Sinatra web apps course https://teamtreehouse.com/library/url-parameters

I am running this locally on my machine and I have the code as follows.

require "sinatra"

def page_content(title) File.read("pages/#{title}.txt") rescue Errno::ENOENT return nil end

get "/" do erb :welcome end

get ":title" do page_content(params[:title]) end

When I add the Nick Pettit to the URL it redirects me to Google. When I add Nick%20Pettit to the URL it gives me the "Sinatra doesnโ€™t know this ditty."

I was under the impression I don't need the "set :bind, "0.0.0.0"" when running the course on my local system rather than using the "Workspaces" version. So other than that I cannot see why this isn't working?

Here is a screen shot of my VS Code screen so you can see how I am setup.

https://snag.gy/2S8LM6.jpg