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 trialSolace Enwere
15,102 PointsBuilding Web Apps with Sinatra - Loading Text Files
Hello, I'm currently following the url parameters video and I pass the title to page_content like this
require "sinatra"
set :bind, "0.0.0.0"
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
So in workspace, when I save and run ruby wiki.rb then link up to the 4567 port and then /Nick Pettit; it's supposed to show the contents of Nick Pettit path riight? (with the Nick Pettit.txt file) but for me it just loads to a blank page. But when I do the same the for /Amit Bijlani it then shows me the the contents of Amit Bijlani.txt
I've reloaded the workspace and everything... any ideas why /Nick Pettit isn't visible but /Amit Bijlani is.