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 Adding New Data Submitting the Form Via POST Request

Christopher Phillips
Christopher Phillips
10,061 Points

Challenge Task 2 of 4

"In guestbook.rb, add a route to accept POST requests to the /signatures/create path. A route block is required, but you can leave it empty for now."

It's returning an error: Bummer, we couldn't find the "post '/signatures/create'" route.

Unless I'm mistaken, I'm staring right at the required code. Can someone please shed some light on this?

views/new.erb
<p>Please enter your name below.</p>

<form method="post" action="/signatures/create">
  <input type="text" name="signature">
  <input type="submit">
</form>
guestbook.rb
require "sinatra"

# Appends the signature to the file as a new line.
def save_signature(signature)
  File.open("signatures.txt", "a") do |file|
    file.puts signature
  end
end

get "/signatures/new" do
  erb :new
end

post "/signatures/create" do
end

2 Answers

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

By now you know what I'm going to say. :)

There was an error with this challenge that we just fixed. Try again now. Your code should pass as-is.

In the future, if you suspect an issue with the code challenge itself, please let us know! You can click the "Support" link at the top of any page to contact Treehouse Support. They will notify the appropriate teacher.

Sorry for the trouble!

Christopher Phillips
Christopher Phillips
10,061 Points

Thanks Jay! I'm honestly glad it was the runner vs me.

Much appreciated! Have a great day!

ps - thanks for the tip. Will do so going forward.