0

Im getting a 'syntax error, unexpected keyword_do_block, expecting keyword_end ... form_for[@event, @document] do |f| @output_buffer.safe_appe... ... ^ ' and 'syntax error, unexpected keyword_ensure, expecting end-of-input'

I trying to add a document submitting form to another page in my project. Is the form_for written incorrectly??

<div class="span5">
  <div class="span8">
    <h3>Event Files</h3>
      <%= form_for[@event, @document] do |f| %>
        <div class="field"><%= f.file_field :doc %></div>
        <div class="actions"><%= f.submit %></div>
    <% end %>
  </div>
</div>
Snick
  • 115
  • 1
  • 10

1 Answers1

3

Try with:

<%= form_for([@event, @document]) do |f| %>
  ...
<% end %>

Where @event = Event.find(params[:id]) and @document = Document.new

Refer: http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for

Hope it helps :)

Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85