Skip to content

Ignore empty filters#150

Merged
toddkummer merged 3 commits into
mainfrom
ignore-empty-filters
Mar 14, 2025
Merged

Ignore empty filters#150
toddkummer merged 3 commits into
mainfrom
ignore-empty-filters

Conversation

@toddkummer
Copy link
Copy Markdown
Member

In a standard search form, with all the possible criteria as form fields, they all get passed by Rails whether they have values or not. This excludes empty filters.

Normally the params are all string values: so False is "false" and True is "true" as parameters. There are some edge cases where params can be added in the controller; in that case they might be True or False. Since False.empty? is true, the check is first done to make sure the value is a string before checking to see if it is empty.

Fixes #149.

@toddkummer toddkummer merged commit 0b4433f into main Mar 14, 2025
@toddkummer toddkummer deleted the ignore-empty-filters branch March 14, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty filters should be ignored

1 participant