Mini John
Mini John

Reputation: 7941

Styling Ransack attribute_fields Select2 Rails plugin

I'm trying to style the select button from Ransack with the Select2 plugin.

  <%= f.attribute_fields do |a| %>
    <%= a.attribute_select %>
  <% end %>

That's generating and HTML output of:

<select id="q_c_0_a_0_name" name="q[c][0][a][0][name]">
  <option value=""></option>
  <option value="name">Name</option>
  <option value="points">Points</option>
  <option value="town_count">Town count</option>
  <option value="rank">Rank</option>
</select>

But somehow i can't find a way to assign to the attribute_fields the id 'select'

What am i missing?

Upvotes: 1

Views: 705

Answers (1)

Mini John
Mini John

Reputation: 7941

Through Ransack_UI i found this:

<%= f.attribute_fields do |a| %>
  <%= a.attribute_select({}, :id => 'select') %>
<% end %>

Upvotes: 2

Related Questions