Rails 4 Autocomplete with Simple Form - class parameter ignored

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?

Answers


Well, pass it like :

input_html: { class: 'form-control' }

Need Your Help

Remove commas and format dates

awk sed grep tr nawk

I have a large file with entries such as:

Exception: The merge filter only works with arrays or hashes in “HerzultForumBundle:Topic:new.html.twig”

php symfony2 internationalization

I'm improving my web application by adding more languages. I've done it following this tutorial: https://coderwall.com/p/eiqd_g

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.