Rails syntax error, unexpected keyword_ensure, expecting keyword_end
You are failing to close 2 of your loops with an <% end %>
.
<% unless @artwork.series.blank? %>
<div class="col-xs-6 col-sm-6 col-md-4">
<p class="field-label">Series</p>
<% @artwork.series.each do |series| %>
<span class="tags">
<%= link_to series.name, series_url(:series => series.name) %>
</span>
<%# Need end here, as illustrated on the next line. %>
<% end %>
</div>
<% end %>
<% unless @artwork.tags.blank? %>
<div class="col-xs-6 col-sm-6 col-md-4">
<p class="field-label">Tags</p>
<% @artwork.tags.each do |tag| %>
<span class="tags">
<%= link_to tag.name, tagged_url(:tag => tag.name) %>
</span>
<%# Need end here, as illustrated on the next line. %>
<% end %>
</div>
<% end %>
Take more care about how you're indenting your code. It matters and helps you to more easily prevent and debug syntax problems like this.
syntax error, unexpected keyword_ensure, expecting keyword_end
For the if statement, you're doing an assignment with '=', we should use '==' instead.
And I think you need to use 'elsif' instead of 'else if'.
Rails syntax error: unexpected keyword_ensure, expecting keyword_end
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:
<% if ... %>
<% @ballot_link = "/vote/#{params[:election_id]}/ballot/#{params[:ballot_position]}" %>
<a href="<%= @ballot_link %>" class="btn btn-primary">Ready</a>
<% else %>
...
<% end %>
SyntaxError unexpected keyword_ensure, expecting keyword_end
Indentation is very important in Slim. You haven't indented anything within your first line, if user.paid?
; you need to do so, or you're producing an if
statement with no body.
Syntax error, unexpected keyword_ensure, expecting keyword_end
You're not properly closing the if
you pasted :
<% if current_user.admin? && !current_user?(user) %>
<li><%= link_to "Admin", users_path %></li>
</end>
You should try to replace that by :
<% if current_user.admin? && !current_user?(user) %>
<li><%= link_to "Admin", users_path %></li>
<% end %>
syntax error, unexpected keyword_ensure, expecting keyword_end in my app
Here
<% else %>
<%= form_for(current_user.active_relationships.find_by(followed_id: user.id), html: {method: :delete}) do |f| %>
<%= f.submit "Unfollow", class: "btn btn-default" %>
<% end %>
</center>
You have the end
to close the block for form_for
but not for ending the if-else
<% else %>
<%= form_for(current_user.active_relationships.find_by(followed_id: user.id), html: {method: :delete}) do |f| %>
<%= f.submit "Unfollow", class: "btn btn-default" %>
<% end %>
<% end %>
</center>
Ruby syntax unexpected keyword_ensure, expecting keyword_end
You have two problems in your code. Your <%end>
should be <%end%>
. This is causing you the syntax error. But, you also should close your <ul>
element. Use the following code:
<ul id="messages">
<% @messages.each do |chat| %>
<li>
<%= current_user.name %> : <%= chat.content %>
</li>
<%end%>
</ul>
Sytax error - unexpected keyword_ensure, expecting keyword_end
The problem is that you're opening a Ruby block here:
<!-- <%= form_for :question, url: '/questions', html: {class: 'form-horizontal'} do %> -->
...but you never close it.
Keep in mind that ERB doesn't know anything about HTML, so putting ERB code inside HTML comments doesn't stop it from running. If you do <!-- <%= "foo" %> -->
it'll render <!-- foo -->
.
If you want to comment out ERb code, replace the opening tag with <%#
:
<%#= form_for :question, url: '/questions', html: {class: 'form-horizontal'} do %>
If your block has a corresponding <% end %>
, don't forget to comment that out as well:
<%#= form_for :question, url: '/questions', html: {class: 'form-horizontal'} do %>
...
<%# end %>
Related Topics
No Such File or Directory @ Rb_Sysopen for External Url/Rails 6.11/Ruby 3
Uri::Invalidurierror: Bad Uri(Is Not Uri) Testing Rails Controllers
"Bad Ecpoint" Ssl Error on Fresh Rvm Ruby 1.9.3 Install on Osx Mountain Lion
Rails 3.2 Create a Form That's Used in the Footer of Every Page
How to Deal with a Page Which Fails to Load and Continue Testing in Watir-Webdriver
"/#Action" Route in Routes.Rb in Ruby on Rails
Brew Install Coreutils Failing 10.9.5 Osx
Loop Within Loop in Rails Controller
Why Is Autoload Failing to Load Files for Gems
Confused with Ruby Accessor Methods
How to Implement Editing/Formating Text Area in Rails
Open Xml File with Nokogiri Update Node and Save
Rails Adding Multiple Objects to an Empty Array
Rubymine 6.0.2, Unable to Debug
Byebug Fully Supports Windows or Not