platanus / activeadmin_addons

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

ActiveAdmin version 3.0.0 released! #475

Closed jgmontoya closed 11 months ago

jgmontoya commented 11 months ago

Hey! Just letting you guys know that ActiveAdmin had a new major version recently released with a couple of breaking changes: https://github.com/activeadmin/activeadmin/releases/tag/v3.0.0

I did a fast search through the project and it seems like it shouldn't really break much on AA_addons. I know you're working in a v2 version of this, so thought you might find it useful to know.

difernandez commented 11 months ago

uh thanks for letting us know!! We'll look into it when we have some time to make sure there's nothing breaking here

ckim310 commented 11 months ago

Just caught something that seems related to the ActiveAdmin version released. I'm seeing an issue with the slim_select_search not querying the collection as expected in my code. Looks related to one of the breaking changes - removing custom Ransack predicates. Hope this helps!

shakemurasan commented 11 months ago

I'm not sure this information is helpful or not. I updated ActiveAdmin 2.14.0 to 3.0.0, then search_select_filter has not working.

Why not working I think current activeadmin_addons build ransack query xxx_contains not a xxx_cont, so it not works. This AA3 braking change said don't support _contains to use _cont.

How to resolve activeadmin_addons provide predicate option. https://github.com/platanus/activeadmin_addons/blob/master/docs/slim-select_search.md#options This option can change predicate contains to cont. Finally, I resolved this problem by specify predicate: 'cont'

Following code block is sample, I just added predicate: 'cont' in this case.

  filter :company_id, as: :search_select_filter, url: proc { admin_companies_path },
                      fields: %i[id name], display_name: :name, minimum_input_length: 1,
                      predicate: 'cont', # Default is `contains` but ransack4 not support it
                      order_by: 'id_asc'
shakemurasan commented 11 months ago

However, it is hard to specify the predicate option in all the places where I use search_select_filter. I would be happy to find some other smart solution.

difernandez commented 11 months ago

Thank you all for your comments, they were very helpful to pinpoint what needed to be changed. As you said, contains is no longer a valid predicate. I opened a PR to stop using it, in favor of Ransack's equivalent cont. The change will be included in our next release. Asides from that, I only had to change test-related code, due to Ransack v4 requiring explicit definition of ransackable_attributes and ransackable_associations, but that doesn't impact the gem's functionality. If anyone finds something else that I might have missed, please let us know