Repository navigation
Conversation
Raise the minimum ransack version to 6.0 in the gemspec and the development Gemfiles, and update the lockfiles to ransack 6.0.0. Supersedes #9133. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ransack 6 makes the cont, start and end predicates case-sensitive on PostgreSQL by generating LIKE instead of ILIKE. String filters used them by default, so searching "mar" no longer found "Mario" there. Default string filters to i_cont, eq, i_start and i_end, which stay case-insensitive on every database. Ransack locales do not translate the i_* predicates, so the filter select and the active filters would show the raw "i_cont" key. Add ActiveAdmin::Filters.predicate_label, which falls back to the translation of the case-sensitive counterpart unless the i_* predicate has its own translation, and use it in both places. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Explain that string filters default to the i_* predicates, that cont, start and end are case-sensitive on PostgreSQL with ransack 6, and how to keep case-insensitive matching for custom string filter settings, predicate filters and filter_method_for_large_association. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9134 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 139 139
Lines 4071 4079 +8
=======================================
+ Hits 4035 4043 +8
Misses 36 36 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Update: this PR is no longer blocked on ransack 6.1.0. ransack 6.1 will only support Rails 8.1+ (activerecord-hackery/ransack#1786, #9135), so raising the minimum is not an option while ActiveAdmin supports Rails 7.2 and 8.0. The PR now keeps 🤖 Generated with Claude Code |
Keep supporting ransack >= 4.0: ransack 6.1 will only support Rails 8.1+, so applications on Rails 7.2 and 8.0 must be able to stay on ransack 5.x or 6.0. Exercise both major versions in CI: Rails 7.2 runs ransack 5.x, Rails 8.0 runs ransack 6.0.x and Rails 8.1 runs the latest release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the ActiveAdmin::Filters.predicate_label fallback that borrowed the case-sensitive translation for i_* predicates. Ransack 6.1 translates i_* predicates itself; ransack 6.0 shows their raw names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Default string filters to i_cont, eq, i_start and i_end when the loaded ransack provides i_start (ransack 6.0+), and to cont, eq, start and end otherwise. Ransack 6 makes cont, start and end case-sensitive on PostgreSQL, so the i_* predicates keep the previous behavior there. Check the predicate registry instead of Ransack::VERSION so prereleases and git checkouts resolve correctly. Specs and features derive the expected predicate and label from the loaded ransack, so they pass with both translated and untranslated i_* predicates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Explain that string filters use the i_* predicates with ransack 6.0+, that cont, start and end become case-sensitive on PostgreSQL with ransack 6, and that ransack 6.0 shows i_* predicates untranslated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rendering a filter with a stubbed i_start predicate fails on ransack 5, which cannot evaluate title_i_start on the search object. Compare the default predicate list directly instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Related upstream issue: activerecord-hackery/ransack#1788 asks for a 6.0.x release (and a 🤖 Generated with Claude Code |
|
Ransack is now at 6.1.1 @tagliala |

Problem
Ransack 6 makes the
cont,startandendpredicates case-sensitive on PostgreSQL: they now generateLIKEinstead ofILIKE. ActiveAdmin string filters used these predicates by default, so on PostgreSQL searching a name for "mar" would no longer find "Mario". The Dependabot bump to ransack 6 (#9133) could not be merged as is for this reason.Requiring a newer ransack is not an option: ransack 6.1 (unreleased) only supports Rails 8.1+ (activerecord-hackery/ransack#1786, #9135), while ActiveAdmin still supports Rails 7.2 and 8.0.
Solution
ActiveAdmin::Inputs::Filters::StringInput.filtersreturnsi_cont,eq,i_startandi_endwhen the loaded ransack provides thei_startpredicate (ransack 6.0+), andcont,eq,startandendotherwise. The check usesRansack::Predicate.named, available since ransack 4.0, rather thanRansack::VERSION, so git checkouts and prereleases resolve correctly.ransack >= 4.0.Ransack::Translate.predicate. Ransack 6.0 has no translations for thei_*predicates, so the filter select and the active filters show the raw names (e.g. "i_cont"); ransack 6.1 translates them ("contains, ignoring case", Translate the predicates missing from every locale activerecord-hackery/ransack#1744).filter_method_for_large_associationkeeps its"_start"default; the upgrade notes explain how to switch to"_i_start".Compatibility
i_*labelsgemfiles/rails_72~> 5.0(5.0.2)cont,eq,start,endgemfiles/rails_80~> 6.0.0(6.0.0)i_cont,eq,i_start,i_endGemfilei_cont,eq,i_start,i_endThe lockfile changes are limited to ransack.
Upgrade notes
UPGRADING.mdanddocs/3-index-pages.mdexplain that:string_input_filters,filters:options,filter :name_contandfilter_method_for_large_association = "_start"become case-sensitive and should switch to thei_*predicates;i_*predicates untranslated; ransack 6.1 translates them but requires Rails 8.1, so applications on earlier Rails versions stay on ransack 6.0 and can add their ownransack.predicatestranslations;q[title_cont]) still filter, but the sidebar shows that filter empty with its first predicate selected.Verification
Specs and features derive the expected predicate from
StringInput.filtersand the expected label fromRansack::Translate.predicate, so the same assertions hold with translated and untranslatedi_*labels. A spec stubsRansack::Predicate.named("i_start")to cover both defaults.main(2910edab, translatedi_*labels): the same full RSpec and Cucumber runs pass.spec/unit/filters,spec/helpers/filter_form_helper_spec.rbandfeatures/index/filters.featurepass.name_i_contandname_i_startwith "mar" generateILIKEand find "Mario";name_contandname_startgenerateLIKEand find nothing.rubocopon the changed files.Supersedes #9133.
🤖 Generated with Claude Code