我正在製作一個名爲Styles
的腳手架,一個用戶用devise製作的模型以及一個叫Category
的模型來過濾styles
。即時得到這個execption陷入_form
頁面,這是代碼:我得到了一個捕捉到的動作控制器異常
<%= simple_form_for @style, :html => { :multipart => true } do |f| %>
<%= select_tag(:category_id, options_for_select(@categories), :prompt => "Select a category"%>
<%= f.input :title, label: "Your style name" %>
<%= f.input :description %>
<%= f.button :submit, :class => 'btn-custom2' %>
<% end %>
我有simple_form和引導創業板安裝,但我不認爲that's問題。欄錯誤頁面是高亮<% end %>
部分,就像這是問題,但我不明白爲什麼。確切的錯誤是
SyntaxError in StylesController#new
C:/Users/mmrma/Downloads/Desktop/marina2.0/marinas-web/app/views/styles/_form.html.erb:8: syntax error, unexpected keyword_end, expecting ')' '.freeze; end ;^C:/Users/mmrma/Downloads/Desktop/marina2.0/marinas-web/app/views/styles/_form.html.erb:10: syntax error, unexpected keyword_ensure, expecting ')' C:/Users/mmrma/Downloads/Desktop/marina2.0/marinas-web/app/views/styles/_form.html.erb:12: syntax error, unexpected keyword_end, expecting ')'
具體是什麼錯誤?你也在你的'select_tag'中拼寫'prompt'。 – jdgray
正如@jdgray所述,它可能與您的選擇標記選項有關,但通常這是一個散列選項,不會破壞任何內容。 另外,您應該在SO問題中包含確切的錯誤和消息。 – fbelanger