我在项目中使用了 chosen-rails
chosen 选择的功能都可以实现,但是它的 css 效果加载不出来
view
<%= f.select :teacher_ids,options_for_select(teachers_array),{},{:multiple => true, :class => 'chzn-select'}%>
application.js
//= require jquery
//= require jquery_ujs
//= require chosen-jquery
//= require scaffold
scaffold.js.coffee
$ ->
# enable chosen js
$('.chzn-select').chosen
allow_single_deselect: true
no_results_text: 'No results matched'
width: '200px'
application.css
*= require chosen