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

Bankole Abawonse
Bankole Abawonse
9,021 Points

Workspace or me?

require "sinatra"

set :bind, "0.0.0.0"

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

def save_content(title, content) File.open("pages/#{title}.txt", "w") do |file| file.print(content) end

get "/" do erb :welcome end

get "/new" do erb :new end

get "/:title" do @title = params[:title] @content = page_content(@title) erb :show end

post "/create" do save_content(params["title"], params["content"]) end

keeps giving me this error. "syntax error, unexpected end-of-input..."

I believe I have the same code as the instructor. Been at it for over an hour. What am I missing?