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 trialAnna Puka
6,264 PointsWhat is the problem?
In the get route for the /hello path, render the views/welcome.erb template.
require "sinatra"
require "views/welcome.erb"
get "/hello" do
erb: welcome
end
<h1>Welcome to our app!</h1>
2 Answers
Ari Misha
19,323 PointsHiya Anna! Lets consider an example, alright? Cool! I want to route request for /hello_world and for the same get request , i'd like render this file called index, okay? Now how are we gonna code this in Sinatra Framework:
.....
get "/hello_world" do
erb :index
end
.....
Did you notice the difference between this example code and your code? I passed "index" template as a symbol, whereas (maybe its just a typo from your side but Ruby aint human) you passed something named "index" to your erb symbol. There is a difference between erb: index or erb: :index or erb :index. That colon matters.
I hope it helped. !
~ Ari
Anna Puka
6,264 Pointsthank you! I have fixed it already.