Reputation: 498
I'm doing the Michael Hartl tutorial and I made it to 7.4.3 The first signup. Then, when I try to signup, I receive an error:
C:/Sites/sample_app/app/views/users/show.html.erb:1: syntax error, unexpected ',', expecting ')' ...putBuffer.new; provide (:title, @user.name) ...
^ C:/Sites/sample_app/app/views/users/show.html.erb:1: syntax error, unexpected ')', expecting keyword_end ...w; provide (:title, @user.name) ... ^
Here is my show.html.erb:
<% provide (:title, @user.name) %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<h1>
<%= gravatar_for @user %>
<%= @user.name %>
</h1>
</section>
</aside>
</div>
The page I get:
If I put in the integration test in 7.4.4 and do rake
:
What am I doing wrong?
Upvotes: 0
Views: 113
Reputation: 1648
AS the error says, you have a syntax error... the error is the space between provides and the parentheses, try this instead:
<% provide(:title, @user.name) %>
Upvotes: 1
Reputation: 1299
Here is a little more explanation for why you are getting a syntax error:
in ruby, parentheses are not required around method calls, but when you do choose to include them, the beginning parenthesis must have no space between itself and the method name, just like java, C, C++, and many other languages.
provide :title, @user.name
# is the same method call as:
provide(:title, @user.name)
Upvotes: 2