Demetrius
2010-Sep-24 00:07 UTC
how to change the order of the group_method parameter in the grouped_collection_select method?
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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Demetrius
2010-Sep-24 16:59 UTC
Re: how to change the order of the group_method parameter in the grouped_collection_select method?
Oops, rere are the associations: State has_many :subjects Subject belongs_to :state has_many :courses Course belongs_to :subject -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.