📜  从 Rails 中的查询中删除 order by - Ruby 代码示例

📅  最后修改于: 2022-03-11 15:04:47.251000             🧑  作者: Mango

代码示例1
Article.order('headline asc').to_sql
#=> "SELECT `articles`.* FROM `articles`  ORDER BY headline asc"

Article.order('headline asc').reorder('').to_sql
#=> "SELECT `articles`.* FROM `articles`"

You can call the reorder method with an empty string. E.g.:
=> http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-reorder