Ruby on Rails — multiple selection in f.select

前端 未结 5 522
故里飘歌
故里飘歌 2020-12-02 15:21

I have the following select box in my form:

Related Type:   <%= f.select(:TYPE, [[\'Type A\', \'Type A\'],
                                  [\'T         


        
5条回答
  •  感情败类
    2020-12-02 15:50

    In case of collection, try

        <%= f.select(:TYPE, Categories.collect {|p| [ p.name, p.id ] }, 
                                               { :prompt => "Please select"}, 
                                               { :multiple => true, :size => 5 }) %>
    

提交回复
热议问题