Atribut :selected in select_tag



  • There's a choice:

    <%= select_tag('group_by',
      options_for_select([[]] + @query.groupable_columns.collect {|c| [c.caption,  
        c.name.to_s]}, @query.group_by)) %>
    

    Tell me how to add an attribute. :selectedto be default empty, that is. :selected => ""?



  • Add the third halper parameter. select_tag Attribution include_blank: trueas a result, you will automatically add to the beginning of an empty line that will be chosen by default

    <%= select_tag('group_by',
      options_for_select(@query.groupable_columns.collect {|c| [c.caption,  
        c.name.to_s]}), include_blank: true) %>
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2