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

Search select multi option #511

Open
wants to merge 4 commits into
base: v1
Choose a base branch
from

Conversation

lbrito1
Copy link

@lbrito1 lbrito1 commented Dec 10, 2024

Motivation / Background

This PR changes the behaviour of SearchSelectFilterInput such that it is now possible to use a multi-value (input_html: { multiple: true }) input.

Detail

I needed the search select filter with multiple values in my app, within the same model (e.g. filtering User.name in the ActiveAdmin User page).

Currently, to the best of my knowledge, this was not possible because SearchSelectFilterInput#input_method was hardcoded to use eq, which breaks ransack at some point with an error like "cannot use eq for [123, 456]" if you try to use multiple: true.

This PR changes SearchSelectFilterInput#input_method to use an appropriate predicate for lists (in) when needed (e.g. when input_html: { multiple: true }).

I had to update some minor gem versions to get bin/setup working.

Additional information

image

image

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a concise description of what changed and why.
  • Tests are added or updated if you fix a bug or add a feature.
  • [X Documentation has been added or updated if you add a feature or modify an existing one.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature (under the "Unreleased" heading if this is not a version change).
  • My changes don't introduce any linter rule violations.

@lbrito1 lbrito1 changed the title Search select multi Search select multi option Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant