Reputation: 194
I have a rails 4 app. I have a form for object in which has field_for another model..
<%= form_for object do |f| %>
<%= f.label:name %>
<%= f.text_field :name %>
<%= fields_for :reference do |f2| %>
<%= f2.file_field_tag :file %>
<%end%>
<% end%>
However, I get "Undefined method 'file_field_tag'". Does anyone know if you can upload files via nested form.
Upvotes: 0
Views: 165
Reputation: 3615
I think because you are using form_for not form_tag.
Try to change:
<%= f2.file_field_tag :file %>
to
<%= f2.file_field :file %>
Upvotes: 2