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

extra_data values not being displayed #107

Open
colinmccann opened this issue Mar 3, 2020 · 0 comments
Open

extra_data values not being displayed #107

colinmccann opened this issue Mar 3, 2020 · 0 comments

Comments

@colinmccann
Copy link

Hi there, I am trying to use :extra_data to search multiple columns in the model. That is, I want a single 'location' input field to show autocompleted results from either the city and country attributes in a model.

The README explains that extra_data is used to 'Passing an array of attributes/column names to this option will fetch and return the specified data'. It's not clear to me if this functions as a solution for me. However, I see this accepted answer on stack: https://stackoverflow.com/questions/30790421/rails-jquery-autocomplete-search-multiple-attributes.

Am I able to use extra_data in this way?

organizations_controller
autocomplete :organization, :city, full: true, limit: 5, :extra_data => [:country]

organization view
= autocomplete_field_tag 'location', '', autocomplete_organization_city_organizations_path

Or do I need to instead overwrite the autocomplete controller method (autocomplete_organization_city)?
This seems to be a pretty common use case, would be great if it was supported...

Thanks

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

No branches or pull requests

1 participant