Breaking changes
LIKEwildcards are now escaped on every adapter, with an explicitESCAPEclause.cont,start,endand theiri_/not_/_any/_allvariants treat the search term literally;%and_typed by a user no longer act as wildcards on SQLite and other backends. Usematchesto pass a pattern. — #1682, fixes #1581- The
ActionView::Helpers::Tags::Base#valuemonkey patch is removed. It let Rails reach privateKernelmethods on any form object and broke unrelated forms in host apps (text_field :testraisedArgumentError). — #1690, closes #1485, relates to #1215 - Combinators are validated and normalised.
'OR',:orand'Or'all meanorinstead of silently becomingAND; underransack!/ignore_unknown_conditions: falsean unrecognised combinator raisesRansack::InvalidSearchErrorat any nesting depth. — #1694, closes #1465 postgres_fields_sort_optionis renamedfields_sort_option(the old name still works).NULLS FIRST/NULLS LASTnow go through Arel and work on any backend that supports them, not only PostgreSQL. — #1696, closes #1463
Features
ignore_blank_valuesconfig option: treat blank values as filters (for JSON APIs) instead of ignoring them (the default, for HTML forms). Typed columns treat a blank asNULL. — #1683, closes #722, #1664- Length predicates:
length_eq,length_lt,length_lteq,length_gt,length_gteq. — #1697, closes #1492, #1655 - Trilogy adapter support, with a CI job to prove it. — #1698, closes #1500, #1501
enumattributes can be searched by label. — #1665- Nested groupings in longhand (
groupings:/conditions:/combinator:), and long-form condition keys (attributes:/predicate:/values:). — #1430, #1694 NULLS FIRST/NULLS LASTon every backend Arel supports. — #1696
Bug fixes
- Fix low-level
c:API silently dropping conditions whena:/v:are arrays of envelope hashes — #1675, closes #1150 - Prune blank conditions from the
c:API at every nesting depth, without mutating the caller's params — #1687, closes #1653 - Strip whitespace at every level of the params, not just the top — #1688, closes #1414, #1502
- Make
search_form_for/search_form_with/turbo_search_form_forhonour a per-searchsearch_key— #1676, closes #1118 - Read a form field's value back through
ransack_alias, so aliased fields survive a round-trip — #1693, closes #689, #1529 - Fix
ActiveModel::RangeErrorwhen a huge integer is searched across multiple attributes in one condition — #1691, closes #1523 - Make
_present/_blankproduce onlyIS [NOT] NULLon non-string columns — #1678, closes #1552 - Fix
ransackable_attributesnot handling symbol arrays — #1539, closes #1538 - Fix scopes inside groupings being silently dropped — #1673, closes #1339, #1490
- Fix a deprecation warning and a correctness bug with
arel_extensions >= 2.2— #1679 - Cast SQL Server's
:datetimeoffsetto time — #1689, closes #1479 - Remove duplicate definitions causing method-redefined warnings — #1677, closes #1434
- Keep an explicit
nilinside an array from discarding the whole condition, for custom predicates — #1657
Compatibility
- Respect
config.active_record.permanent_connection_checkout:lib/no longer calls the deprecatedActiveRecord::Base.connection, and metadata lookups no longer lease a connection. — #1692, closes #1570
Documentation
- New sections on the advanced search parameter structure, combinators, blank values, whitespace stripping,
LIKEwildcards,enumattributes, length predicates, sortingNULLs, and symbol allowlists. — #1695 and the PRs above