josefarias / hotwire_combobox

An accessible autocomplete for Ruby on Rails.
https://hotwirecombobox.com
MIT License
456 stars 30 forks source link

Pass display and value as locals to render_in evals #107

Closed josefarias closed 6 months ago

josefarias commented 6 months ago

Closes https://github.com/josefarias/hotwire_combobox/issues/101

Display and value are now accessible as locals in the partials passed to :render_in. You can access them via combobox_display and combobox_value.

Passing an ActiveRecord::Relation or an array of objects as the second parameter to combobox_tag are the only cases where the rendered object is an active record (so, when rendering partial: "colors/color", calling color returns the active record). In all other cases, the rendered object is the display text — that is, the text that's used for filtering and autocompleting (equivalent to combobox_display).