From 6256734e2d0bdd89f4b5d11da259d40afa0c95c7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 18 Sep 2013 16:09:13 -0700 Subject: ActiveRecord::Base#<=> has been removed. Primary keys may not be in order, or even be numbers, so sorting by id doesn't make sense. Please use `sort_by` and specify the attribute you wish to sort with. For example, change: Post.all.to_a.sort to: Post.all.to_a.sort_by(&:id) --- activerecord/lib/active_record/core.rb | 9 --------- 1 file changed, 9 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 07d997b719..0bc6933918 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -308,15 +308,6 @@ module ActiveRecord @attributes.frozen? end - # Allows sort on objects - def <=>(other_object) - if other_object.is_a?(self.class) - self.to_key <=> other_object.to_key - else - super - end - end - # Returns +true+ if the record is read only. Records loaded through joins with piggy-back # attributes will be marked as read only since they cannot be saved. def readonly? -- cgit v1.2.3