How do you normally sort items in Rails?

后端 未结 2 1182
轮回少年
轮回少年 2021-02-05 03:58

I have a little example Rails app called tickets, which views and edits fictional tickets sold to various customers. In tickets_controller.rb, inside def index, I h

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 04:23

    I specify an order in the ActiveRecord finder or in the model association because sorting using SQL is faster. You should take advantage of the features offered by the RDBMS when you're able to do so.

提交回复
热议问题