Document behaviour shipping in 4.5.0 - #1695
Merged
Merged
Conversation
Three changes merged for 4.5.0 had no documentation: enum (#1665) was entirely undocumented. Adds a section showing that an Active Record enum can be searched by label, with eq and in examples, so a select built from Model.enums.keys can be posted back unchanged. Per-search search_key (#1676): the configuration page still told readers to repeat the key as `as: :log_search` in the view, which was the workaround for the bug that PR fixed. The helpers now read it from the search object. Symbol allowlists (#1539): records that ransackable_attributes and ransackable_associations accept symbols or strings interchangeably, and that a symbol list previously matched nothing. Each example was run against the spec schema. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was opened by Claude (Claude Code), acting on behalf of @scarroll32.
Three changes already merged for 4.5.0 shipped without documentation.
enumsupport (#1665)Entirely undocumented — nothing in
docs/mentioned enums at all, so there was no way to know Ransack handles them short of reading the specs. Adds a section to Search Matchers showing that an enum can be searched by label rather than underlying value:which is what makes a select built from
Person.temperaments.keyspost back cleanly.Per-search
search_key(#1676)The Configuration page still told readers to write
<%= f.search_form_for @search, as: :log_search %>— thatas:was the workaround for the bug #1676 fixed. Updated to show the helpers reading the key from the search object, with a note that passing it explicitly still works and still wins.(The old snippet also had a bug of its own:
f.search_form_forrather thansearch_form_for.)Symbol allowlists (#1539)
Records that
ransackable_attributesandransackable_associationsaccept symbols or strings interchangeably — and that before 5.0 a symbol list matched nothing, so searches were silently ignored. That's worth stating explicitly, since the failure mode gave no error.Verification
Every example was run against the spec schema rather than written from memory — including rendering a real
search_form_forthrough a controller view context to confirm the field names come out asperson_search[name_cont].Note on #1657
While checking examples for this, I found that #1657 (
Allow nil values in array) doesn't do what its title suggests for built-in predicates:The change keeps the parameter alive through
Search#initialize, but the built-ininpredicate's validator still rejectsnilafterwards. It only helps a custom predicate with a permissive validator — which was the author's actual use case in #940. So it's not wrong, just narrower than the title reads, and I've deliberately not documented it as a user-facing feature. Worth wording carefully in the release notes.🤖 Generated with Claude Code