Skip to content

Commit

Permalink
change sort to use ID, since it is guaranteed unique where created_at…
Browse files Browse the repository at this point in the history
… is not and we are looking for a single unique record
  • Loading branch information
Michael Tucker committed Apr 19, 2015
1 parent 699b1c3 commit f542b5a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/friendly_id/history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f542b5a

Please # to comment.