Question

In my rails app, I have the following nested form fields:

<%= simple_form_for [@page, @section], html: { multipart: true } do |f| %>

    <%= f.simple_fields_for :assets do |asset_fields| %>

        <%= asset_fields.file_field :attachment %>

Now..using:

<%= asset_fields.file_field :attachment %>

this works as expected.. but when I do:

<%= asset_fields.input :attachment, as: :file %>

I get wrong number of arguments (4 for 1) ... what am I missing? I didn't see anything else in the documentation.. The file upload works fine as is; but I would like to use simple form helpers/styles and such.

No correct solution

OTHER TIPS

The syntax is little different for file field as follows.

<%= f.simple_fields_for :assets do |asset_fields| %>
    <%= asset_fields.input :attachment, as: :file, input_html: {} %>
<%- end %>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top