Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveAdmin version 3.0.0 released! #475

Closed
jgmontoya opened this issue Jul 23, 2023 · 5 comments · Fixed by #477
Closed

ActiveAdmin version 3.0.0 released! #475

jgmontoya opened this issue Jul 23, 2023 · 5 comments · Fixed by #477

Comments

@jgmontoya
Copy link
Contributor

jgmontoya commented Jul 23, 2023

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
Copy link
Contributor

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
Copy link

ckim310 commented Jul 28, 2023

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
Copy link

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
Copy link

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 difernandez mentioned this issue Aug 3, 2023
6 tasks
@difernandez
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants