I am using Simple Form, along with the Rails Autocomplete gem.
I have a straightforward form control, where the autocomplete is working as intended:
<%= f.input :practice, as: :autocomplete, url: autocomplete_practice_name_shifts_path, id_element: '#shift_practice_id', class: 'form-control' %>
This works perfectly, except that the class: 'form-control'
parameter is not being translated onto the form.
If I remove the autocomplete parameters like so:
<%= f.input :practice, id_element: '#shift_practice_id', class: 'form-control' %>
The class carries through correctly; as such, it seems to be the autocomplete option that is overriding the class.
Can anybody advise what the correct way to set the class on this input is?
好吧,像这样传递它:
input_html: { class: 'form-control' }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.