rails 4 bootstrap group buttons with acts as taggable on edit, not pushed down

I'm using acts as taggable on gem and I'm trying to create a nice looking group button, but it doesn't stay marked if I'm editing the form. I know that the database did indeed save the value. I can even change the value and save when I edit, but when I go back to the edit button, it doesn't show which button got saved.

.btn-group{ data: { toggle: "buttons" } }
  - ["Value1", "Value2", "Value3"].each do |item|
    = f.label item, class: "btn btn-default" do
      = f.radio_button :tag_list, item
      = item

Looks like this:

Would like to have this on edit:

在这里输入图像描述

Am I missing a simple method that will show what the value is?


checked属性添加到您的radio_button

= f.radio_button :tag_list, item, checked: f.object.tag_list.include?(item)
链接地址: http://www.djcxy.com/p/6114.html

上一篇: Mdbg,Dbgclr,Cordbg

下一篇: 导轨4引导组按钮在编辑时充当标签,而不是按下