我試圖將頭像上傳字段添加到我的個人資料頁面,但只要我將:html => {:multipart => true}
添加到它,它就會吐出語法錯誤。Form_for with:multipart => true吐出
<%= form_for(@user), :html => { :multipart => true } do |f| %>
<%= render 'shared/error_messages', object: f.object %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :email %>
<%= f.email_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label :password_confirmation, "Confirmation" %>
<%= f.password_field :password_confirmation %>
<%= f.label :avatar %>
<%= f.file_field :avatar %>
<%= f.submit "Save changes", class: "btn btn-large btn-primary" %>
<% end %>
的錯誤是:
syntax error, unexpected tASSOC, expecting keyword_end
...end= form_for(@user), :html => { :multipart => true } do |f...
... ^