Ruby

Solace Enwere
Solace Enwere
10,307 Points

Building 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.