From f542b5a52aa60b84de2bc94010c0e212c66ce19e Mon Sep 17 00:00:00 2001 From: Michael Tucker Date: Sun, 19 Apr 2015 08:28:50 -0700 Subject: [PATCH] change sort to use ID, since it is guaranteed unique where created_at is not and we are looking for a single unique record --- lib/friendly_id/history.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/friendly_id/history.rb b/lib/friendly_id/history.rb index cf1ac4580..cba11746d 100644 --- a/lib/friendly_id/history.rb +++ b/lib/friendly_id/history.rb @@ -95,7 +95,7 @@ def first_by_friendly_id(id) end def slug_table_record(id) - select(quoted_table_name + '.*').joins(:slugs).where(slug_history_clause(id)).order(Slug.arel_table[:created_at].desc).first + select(quoted_table_name + '.*').joins(:slugs).where(slug_history_clause(id)).order(Slug.arel_table[:id].desc).first end def slug_history_clause(id)