Is it possible to use best_in_place with typeahead from twitter bootstrap?

Basically, I use best_in_place in my rails webapp to allow users to edit their profile information. The thing is, I would like users to submit a type form for some records. Here I work with:

<p>College/University: <input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="8" data-source='["University of Pennsylvania","Harvard","Yale","Princeton","Cornell","Brown","Columbia","Dartmouth"]'></p>

This gives me a form field for working with typeahead. However, I want to be able to wrap this in best_in_place with something like

<%= best_in_place @student, :education %>

so that users can only see the type form when they click on the text, and, clicking away from the window or clicking, enter the selection that is stored in the database.

Is there an easy way to do this?

+5
source share
1 answer

Ruby on rails, best_in_place, :html_attrs. , :

<%= best_in_place @student, :education, :type=> :input, 
    :html_attrs => {:'data-provide' => "typeahead", // Any other attributes 
                    :'data-source' => '["University of Pennsylvania","Harvard","Yale","Princeton","Cornell","Brown","Columbia","Dartmouth"]' %>

, !

0

All Articles