Anyone know how to order the group_method parameter in the
grouped_collection_select method? I get a nice list of subjects in my
drop down BUT they are not in order (alpha…)
My code is below (:subjects is my group_method parameter).
<%= grouped_collection_select(:course, :subject_id,
State.where(“id = ? OR state_abbr = ?”, current_teacher.state_id,
‘CC’), :subjects, :name, :id, :name, {:prompt => true} )%>
I’ve tried something like this: Subject.order(‘name’)… but get the
following error:
(eval):1: syntax error, unexpected $end
group.#ActiveRecord::Relation:0x00000102cb71d8
Or, :subject.order(‘name’)… but get this error:
undefined method `order’ for :Subject:Symbol