Multi Select Array - Form - Bootstrap Multiselect

10 views
Skip to first unread message

Fatima Fatima

unread,
Aug 10, 2014, 6:52:07 PM8/10/14
to rubyonra...@googlegroups.com
Hi,

I have a form where I can select one attribute and it passed on to my
database. Is there any way to make multiple attributes passed on to my
database just via a change in the form? Or would I have to create a new
model and have it pass through that way?

<div class="form-group">
<%= f.label :kind %><br>
<select class="multiselect">
<%= f.select :kind,
[['beer','0'],['chocolate','1'],['cocktail','2'],['coffee','3'],
['tea','4'], ['wine','5'], ['juice','6']], class: "form-control" %>
</select>
</div>

I tried adding a multiselect gem:
https://www.omniref.com/ruby/gems/bootstrap-multiselect-rails/0.0.2

and added the js as indicated here:
https://github.com/davidstutz/bootstrap-multiselect

But for my "f.select" button, not sure what I need to add? If I do the
option list as in the plugin documentation, how would I make it save to
:kind in my database?

Thanks,
Fatima

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages