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 Practice Sinatra Basics Practice ERB Templates ERB Templates

anyone able to finish this challenge? completed the rest but i stumped here.

Ive finished the sinatra course and was able to complete the other challenges but this one has me feeling lost.

app.rb

views/word.erb

2 Answers

yk7
seal-mask
.a{fill-rule:evenodd;}techdegree
yk7
Full Stack JavaScript Techdegree Student 22,891 Points

Hello Paige, sorry for the Delayed replay;

you see your code here is perfect:

h1><%= @word %></h1> 
<p>Backwards: <%= @word.reverse %>
</p> <p>Uppercase: <%= @word.upcase %></p> 
<p>Length: <%= @word.length %></p>

the issue is in the APP.erb file. nice Job it was just a small bobo,

require 'sinatra'
get "/:word" do
 @word = params[:word] 
*** :****
end

ok, so the ***** is a missing line in your code to point(redirect) to the HTML template.

the link if you need refresh; https://teamtreehouse.com/library/getting-html-from-a-template

yk7
seal-mask
.a{fill-rule:evenodd;}techdegree
yk7
Full Stack JavaScript Techdegree Student 22,891 Points

Hello! the challenge consists of two part;

1.from the URL you have to save to a variable whatever word after the "/" : you can just this video: https://teamtreehouse.com/library/url-parameters start from 2nd min!

2.the instance variable that you just created you will use it in the word.erb. and manipulated as it s required by using the method mentioned in the challenge: .reverse .upcase .length

Hope that Helps ! :)

Hi Youssef thanks for helping - I am getting closer! I am still getting an error "The response for /dog doesn't seem to include an h1 element with the text "dog".

this is what i currently have:

<h1><%= @word %></h1> <p>Backwards: <%= @word.reverse %></p> <p>Uppercase: <%= @word.upcase %></p> <p>Length: <%= @word.length %></p>

in APP.erb:

require 'sinatra'

get "/:word" do @word = params[:word] end

thank you!