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

Add primary_key option to search select #485

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from

Conversation

cprodhomme
Copy link
Contributor

@cprodhomme cprodhomme commented Oct 26, 2023

for activeadmin_addons v1

Motivation / Background

I have this architecture :

Account
User
Item

Item -> UserItem -> User -> Account

I want to filter Item and search only on Account url like this :

  filter :user_id,
         as: :search_select_filter,
         url: proc { admin_accounts_path },
         fields: %i(email),
         display_name: "email",
         minimum_input_length: 2,
         order_by: "email_asc",
         primary_key: "user_id"

(obviously, to do that, i have add user_id in the json response of accounts#index)

Detail

This Pull Request add primary_key option for search select

Additional information

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.
  • 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.

for activeadmin_addons v1
@cprodhomme
Copy link
Contributor Author

I can made another PR for the v2 if you want with the same usage

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