0

I want to upload a csv file using active admin, and I would like to know if this is possible, create a from_tag inside of a f.input:

    <%= f.inputs do%>
    <%= f.input :contact, :as => :select, :collection => Contact.all %>
    <%= f.input :route_import, :as => :select, :collection => RouteImporter.all %>
    <% form_tag({:action => :upload}, :multipart => true) do %>
        <%= file_field_tag 'upload_data'%>
    <% end %>
<%end%>

When I run it I get this error:

Routing Error No route matches {:action=>"upload", :controller=>"admin/routes"}

I'm trying to call the method upload which is in RouteQuickcom class, what I'm doing wrong?Thanks!

Anna
  • 203
  • 2
  • 7
  • 23

1 Answers1

0

A quick note, that won't fix your routing problem :

Putting a form into another form is not valid HTML, and from my experience, browsers don't know how to deal with this and end up submitting the master form, but apparently there's some work-around if you really want to do it : Is it valid to have a html form inside another html form?

Community
  • 1
  • 1
Anthony Alberto
  • 10,325
  • 3
  • 34
  • 38