Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

remove order by from query in rails

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #order #query #rails
ADD COMMENT
Topic
Name
8+3 =