You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Rails 4.1.0.rc1 and I have the following
class User < ActiveRecord::Base
default_scope { order(:created_at => :desc) }
end
class UsersController < ApplicationController
def index
@users = User.reorder(params[:order])
end
end
> User.all.to_sql
=> "SELECT `users`.* FROM `users` ORDER BY `users`.`created_at` DESC"
> User.reorder(nil).to_sql
=> "SELECT `users`.* FROM `users`"
I don't know if this is more of a feature request but I'm guessing that this is somehow common. I expect the reorder method not to remove the default order if the passed argument is nil.
The text was updated successfully, but these errors were encountered:
# Replaces *any* existing order defined on the relation with the specified order.
You can post your feature request to the rails-core mailing list as pointed by @pftg but I'm not sure that this is worth and actually achievable to be honest. Thank you guys!
I'm using Rails 4.1.0.rc1 and I have the following
I don't know if this is more of a feature request but I'm guessing that this is somehow common. I expect the reorder method not to remove the default order if the passed argument is nil.
The text was updated successfully, but these errors were encountered: