Reputation: 1363
Ok here's my problem. I have a dropdown of subcategories ordered by category. That's cool, but I really need to order subcategories as well. Here's the code in question:
<%= grouped_collection_select(:subcategory, :id, Category.order(:name), :populated_subcategories, :name, :id, :name, {}, { :class=> "form-control" }) %>
Upvotes: 0
Views: 48
Reputation: 10406
If you set ordering on the association it should work I think.
has_many :populated_subcategories, -> { order('name') }
Upvotes: 1