<h1>Get Ready</h1>
<% if params[:ballot_position].to_i > 1 %>
<p>
Voter <%= params[:ballot_position].to_i - 1 %>, go get voter <%= params[:ballot_position] %>
and switch places with them.
</p>
<p>
Voter <%= params[:ballot_position] %>, when you are ready, click the button marked "Ready" below.
</p>
<% @ballot_link = "/vote/#{params[:election_id]}/ballot/#{params[:ballot_position]}" %>
<a href="<%= @ballot_link %>" class="btn btn-primary">Ready</a>
Above code seems to be resulting in:
ready.html.erb:13: syntax error, unexpected keyword_ensure, expecting keyword_end
ready.html.erb:15: syntax error, unexpected $end, expecting keyword_end
What's going on? What's wrong with this syntax?
You are using if condition. So you should end it. The basic if conditions syntax for erb is
You have to decide what are you using ? It is if condition or if-else condition
In you case, there is not <% end %> clause at end so you have to add it.
My issue was that I forgot to end a do block when creating a link using link_to. My incorrect code looked like:
I had forgotten to end the do statement. The correct code looks like:
Hope this helps someone.
The errors you're receiving more than likely stem from trying to execute a if-else conditional wherein you have an extra
<% end %>
before<% else %>
. Ensure that your conditional follows canonical if-else-end logic like the following: