ruby - Rails syntax error: unexpected keyword_ensure, expecting keyword_end -
<h1>get ready</h1> <% if params[:ballot_position].to_i > 1 %> <p> voter <%= params[:ballot_position].to_i - 1 %>, go voter <%= params[:ballot_position] %> , switch places them. </p> <p> voter <%= params[:ballot_position] %>, when ready, click 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 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 syntax?
the errors you're receiving more stem trying execute if-else conditional wherein have <% end %>
before <% else %>
. ensure conditional follows canonical if-else-end logic following:
<% if ... %> <% @ballot_link = "/vote/#{params[:election_id]}/ballot/#{params[:ballot_position]}" %> <a href="<%= @ballot_link %>" class="btn btn-primary">ready</a> <% else %> ... <% end %>
Comments
Post a Comment