Open Andrew-Max opened 9 months ago
@Andrew-Max I had a similar issue where this code didn't filter:
f.input :customer_car, as: :nested_select,
display_name: :display_name,
minimum_input_length: 0,
level_1: {
attribute: :customer,
minimum_input_length: 1,
fields: %i[id name phone]
},
level_2: {
attribute: :customer_car,
fields: %i[id plate_number]
}
It also sent "customer_eq"=>"-1"
. I made it work by making the attribute in level 1 customer_id
f.input :customer_car, as: :nested_select,
display_name: :display_name,
minimum_input_length: 0,
level_1: {
attribute: :customer_id,
minimum_input_length: 1,
fields: %i[id name phone]
},
level_2: {
attribute: :customer_car,
fields: %i[id plate_number]
}
This made the parameters like this:
{"order"=>"id_desc", "q"=>{"groupings"=>{"0"=>{"m"=>"or", "id_eq"=>"", "plate_number_cont"=>""}}, "combinator"=>"and", "customer_id_eq"=>"9"}, "customer_car"=>{}}
I'm on v2.0.0.beta.3
Describe the bug I've implemented a nested select and it all renders. But my the values in the second field are not scoped to the selection of the first field and if I look in the controller action that handles this, no ID is being passed to it at all to scope based off of
To Reproduce
When I bind in the controller that handles the index request, here are what the params look like:
=> #<ActionController::Parameters {"order"=>"name_desc", "q"=>{"groupings"=>{"0"=>{"m"=>"or", "name_cont"=>""}}, "combinator"=>"and", "customer_eq"=>"-1"}, "controller"=>"admin/shipping_addresses", "action"=>"index"} permitted: true>
Additional context I've also been completely unable to figure out how to view the js in the browser or to try to figure out a way to monkey patch any of this. Open to suggestions on that if anyone know what to do.