-1
我打印出由公司要求已回答問題的用戶的列表進行排序打印表:如何通過DESC
<% @applications.all.each do |application| %>
<% application.answers.each do |answer| %>
<p>Your question1: <%= answer.application.question_1 %></p>
<p>Their answer 1: <%= answer.answer_1 %></p>
<p>Your question 2: <%= answer.application.question_2 %></p>
<p>Their answer 3: <%= answer.answer_2 %></p>
<p>Your question 3: <%= answer.application.question_3 %></p>
<p>Their answer 3: <%= answer.answer_3 %></p>
<i>Answered by <b><%= link_to "#{answer.user.fullname}", user_path(answer.user.slug) %></b>, <%= time_ago_in_words(answer.created_at) %> ago</i> | <%= button_to "delete this applicant", root_url, data: { confirm: "Are you sure?"}, method: :delete %>
<hr>
現在的問題是,他們沒有在任何特定的訂購。我想排序'created_at DESC',但一直未能成功完成。我在視圖中還是在模型中執行操作?這裏推薦的是什麼,我該怎麼做。