I need to render a <select>
with some values.
Those values correspond to a model that the rendered view's model belongs_to
- e.g. Foo has_many
Bar, I'm rendering Bar, and its form should include Foo's ids and names in the <select>
.
That is no problem - right now I'm using simple_form for that.
But in addition to a fixed set of values, the user should be able to insert a new Foo aynchronously (in some popup / whatever), updating the <select>
in the browser with the newly-generated id, and the given name.
That is no problem to implement by hand, but is there a Rails feature (like UJS) or plugin (like simple_form) which provides exactly that?
You can try selectize-rails
Examples can be found here. http://brianreavis.github.io/selectize.js/