Form_tag :remote=>true not passing params as Array

Hello i have a lot of time trying to figure this out.
I am having problem sending array params with form_tag :remote=>true

form.erb
<%#= form_tag reporte_client_reports_path do%>
<%= form_tag reporte_client_reports_path,:remote=>true do%>

<%= label_tag :cuts %> <%= select_tag "cuts[]", options_from_collection_for_select(@cuts, "real_cut", "cut"), :multiple=>true, :id => "cuts"%>

<%= submit_tag 'Send' %>

<%end%>

Controller
def report
@cuts = params[:cuts]

respond_to do |format|
format.html {render :layout => false if request.xhr?}
format.js #{render :layout => false}
end
end

Results

debug results:

  • 2011-02-15,2011-02-28,2011-03-15,2011-03-31

It work if i use
<%= form_tag reporte_client_reports_path do%>

debug results:

  • “2011-02-15”
  • “2011-02-28”
  • “2011-03-15”
  • “2011-03-31”

The problem is in remote the form pass the parameters not as a array :s

I resolved in functional way, but there might be something very weird
with this in my controller:

if request.xhr?
@super = params[:supermercados].to_s.split(",")
@cortess = params[:cortes].to_s.split(",")
@prods = params[:productos].to_s.split(",")
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs