Search code examples
ruby-on-railsruby-on-rails-4acts-as-taggable-on

Rails turning select to checkbox acts_as_taggable_on


I have the following select form which works. I want to turn it into a checkbox. I've tried it for a while but to no avail. I'd appreciate your help

<%= f.select :tag_list, Artist.tag_counts_on(:tag), {}, {:multiple => true, :class => "tags-select", selected: :tag_list } %>

Solution

  • Something like below should do

    <% Artist.tag_counts_on(:tag).each do |some_value| %>
      <%= f.check_box(:tag_list, { :multiple => true }, some_value, nil) %>
    <% end %>