-2

这是我的代码,我无法按 first_name 对名称进行排序

 <%= f.collection_select :donation_id, @donation_array,
      :id,  :dropdown_display,:order => ("first_name DESC"),
      :prompt => "Select Donation Detail", :include_blank => true %>
4

1 回答 1

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 %>
于 2013-09-25T09:40:49.303 回答