Ruby Building Web Apps with Sinatra Adding New Data Submitting the Form Via POST Request

Christopher Phillips
Christopher Phillips
10,049 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,049 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.