Aaron Aaron - 1 year ago 129
Ruby Question

unexpected keyword_do_block expecting keyword_end

New to rails and am getting error and not sure why. Here is the entire error

/Users/aaronmk2/Desktop/CodingDojo/book_review/app/views/books/_form.html.erb:1: syntax error, unexpected ':', expecting keyword_end ...pend= simple_form_for @book :html => {:multipart => true} ... ... ^ /Users/aaronmk2/Desktop/CodingDojo/book_review/app/views/books/_form.html.erb:1: syntax error, unexpected keyword_do_block, expecting keyword_end ...tml => {:multipart => true} do |f|@output_buffer.safe_appen... ... ^ /Users/aaronmk2/Desktop/CodingDojo/book_review/app/views/books/_form.html.erb:10: syntax error, unexpected keyword_ensure, expecting end-of-input

Here is the code for the _form.html.erb

<%= simple_form_for @book :html => {:multipart => true} do |f|%>
<%= select_tag(:category_id, options_for_select(@categories), :prompt => "Select a category")%>
<%= f.file_field :book_img%>
<%= f.input :title, label: "Book Title" %>
<%= f.input :description %>
<%= f.input :author %>
<%= f.button :submit %>
<% end %>

The error seeks to be looking for keyword end, but I have end at the bottom the the form

Answer Source

You forgot a comma at first line:

<%= simple_form_for @book, :html => {:multipart => true}  do |f|%>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download