Rails3.2 remote select


#1

Hi, I work with remote select. I have two select and in base of the
value of the first select I fill the second select…for example

<%= form_for(@person) do |f| %>

 <%= f.collection_select(:car_id,cars,:id,:tcode, {}, {data:{

remote: true, url: ajax_filter_magazine_car_path(0),“data-type” =>
“json”}}) %>

 <%= f.collection_select(:magazine_id,cars,:id,:tcode, {}) %>

my problem is that rails send to the controller the json in this format

params[:person][:car_id] so name of model and key-value

But I have to execute in many case this operation in differents
form…This format is a problem because the json can be

params[:person][:car_id]
params[:office][:car_id]
params[:calendar][:car_id]

But i want only params[:car_id]
So in the controller I have to parse in many different way the json…The
is the possibility to send only params[:car_id]?


#2

change the name of select field tag and try once.