对rails很新,我遇到了错误并且不确定原因。这是整个错误
/Users/aaronmk2/Desktop/CodingDojo/book_review/app/views/books/_form.html.erb:1:语法错误,意外':',期待keyword_end ... pend = simple_form_for @book:html => {:multipart => true} ... ... ^ /Users/aaronmk2/Desktop/CodingDojo/book_review/app/views/books/_form.html.erb:1:语法错误,意外的keyword_do_block,期待keyword_end ... tml => {:multipart => true} do |f|@output_buffer.safe_appen ... ... ^ /Users/aaronmk2/Desktop/CodingDojo/book_review/app/views/books/_form.html.erb:10:语法错误,意外的keyword_ensure,期待结束-of-输入
以下是_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 %>
该错误试图寻找关键字end,但我在底部结束了
答案 0 :(得分:2)
你忘记了第一行的逗号:
c_int(n).value
答案 1 :(得分:1)
您只需添加逗号即可。你的第一行应该是这样的:
<%= simple_form_for @book, :html => {:multipart => true} do |f|%>