这是我的代码,我无法通过first_name
对名称进行排序 <%= f.collection_select :donation_id, @donation_array,
:id, :dropdown_display,:order => ("first_name DESC"),
:prompt => "Select Donation Detail", :include_blank => true %>
答案 0 :(得分:0)
你不能这样订购,当你像这样拉动donation_array时就完成了
@donation_array = Donation.order('first_name DESC').all
并像这样创建你的收藏
<%= f.collection_select :donation_id, @donation_array,
:id, :dropdown_display,
:prompt => "Select Donation Detail", :include_blank => true %>