I’m running into two errors here that I am not sure how to deal with. I get 2 errors when the following page is to load (it doesn’t load at all, just shows me the 2 errors when I try to access it).
Error 1: /home/<…>/profile_pic.html.erb:7: syntax error, unexpected kDO_BLOCK
…ofile_pics, ProfilePic.new, do |builder| @output_buffer.safe…
Error 2: /home/<…>/profile_pic.html.erb:16: syntax error, unexpected kENSURE, expecting $end
Here is the code that is causing us problems:
<%= render :partial => ‘layouts/head_loggedin’ %>
<div id="main" style="float: left;">
<% render :partial => 'layouts/head_settings' %>
<h1>Change your profile picture</h1>
<%= form_for(:update_profile_pic, :url => {:controller => 'setting', :action => 'update_profile_pic'}, :html => {:multipart => true}) do |f|%>
<%= f.fields_for :profile_pics, ProfilePic.new, do |builder| %>
<%= builder.file_field :image %>
<% end %>
<div>
<%= submit_tag "Upload" %>
</div>
<% end %>
</div>
Another page where we use that same do |builder| syntax gives the same unexpected kDO_BLOCK error as this page.
We are using paperclip to upload the pictures. On my friend’s laptop however this issue doesn’t seem to happen at all. We are both running ubuntu, our gemfiles are identical … and the kicker here is, we have both checked out code from the same repo!
You have a stray comma:
The Ruby parser is looking for another argument for
f.fields_forbut it sees a block and gets upset, hence the “unexpected kDO_BLOCK” error.The second error:
is probably a side effect of the first one but, since there isn’t a line 16 in your posted ERB, I can’t be sure.