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 trialAndrew Ackerman
8,347 PointsStruggling with task 3.
I'm not entirely sure how to ask this, but I'm very confused as to what I'm doing wrong, am I over thinking this?
<p>Please enter your name below.</p>
<form method="post" action="/signatures/create">
<input type="text" name="signature">
<input type="submit">
</form>
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
save_signature(params["text"], params["signature"])
redirect URI.escape"/#{params["text"]}"
end
2 Answers
Jay McGavren
Treehouse Teachersave_signature
takes one argument, but you're passing two. Reduce it to one (and make sure it's the correct one, because only one of the two parameters you're accessing is valid), and Task 3 should pass.
Andrew Ackerman
8,347 PointsThank you so much for that!
Andrew Ackerman
8,347 PointsAndrew Ackerman
8,347 PointsThe task is "Within the post "/signatures/create" route block, call the save_signature method. save_signature takes a signature string as an argument, so pass it the value of the signature form field."
I'd really appreciate any help! Thanks!