platanus / activeadmin_addons

Extends ActiveAdmin to enable a set of great optional UX improving add-ons
MIT License
761 stars 288 forks source link

[BUG] Filter using Slim Select no longer sending form parameters #494

Open duckworth opened 8 months ago

duckworth commented 8 months ago

Describe the bug The default filters for string (equals, starts with, ends with, contains) no longer work. When the default active admin filter select is replaced with the Slim Select version it no longer sends the correct params, it just sends the default i.e. q[name_cont]: test even if you choose starts with, ends with, etc.

To Reproduce Steps to reproduce the behavior:

  1. Start the dummy app using the latest versions:
    ransack (4.1.1), activeadmin (3.2.0) activeadmin_addons (2.0.0.beta.3)

  2. Goto /admin/categories

  3. choose "starts with"

    image
  4. Click filter

  5. It sends up q[name_cont]: test and does not filter by starts with

Choosing any other filter option does not change the filter.

sudiptam123 commented 7 months ago

somewhat similar issue is being faced by me as well. I am using search select filter as follows using activeadmin: 3.2.0 using activeadmin_addons: 1.10.0 ransack: 4.0.0

filter :domain_id, as: :search_select_filter, url: proc { capability_domains_index_admin_capabilities_path }, fields: %i[key name], display_name: 'name', minimum_input_length: 2, method_model: Domain, order_by: 'name_asc', label: 'Domain'

{"order"=>"name_asc", "q"=>{"groupings"=>{"0"=>{"m"=>"or", "key_contains"=>"jk", "name_contains"=>"jk"}}, "combinator"=>"and"}, "controller"=>"admin/capabilities", "action"=>"capability_domains_index"}

while am not sure what updates were made, but quite confusing to see as to why the parameter formats of :q are being sent this way. This makes it difficult to pass the parameters to the model level as "Domain.ransack(params[:q]).result" would simply result in selecting all the models and hence the parameters are not taken into consideration at the backend query at all. Pls suggest if there's any alternative or any other ways to mitigate this.