Skip to content

Commit

Permalink
Performance improvement for finding if a slug is already used or not
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Hodgson committed Dec 9, 2013
1 parent 0732bdf commit 31b573f
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 @@ -81,7 +81,7 @@ module FinderMethods
include ::FriendlyId::FinderMethods

def exists_by_friendly_id?(id)
joins(:slugs).where(arel_table[friendly_id_config.query_field].eq(id).or(slug_history_clause(id))).exists?
where(arel_table[friendly_id_config.query_field].eq(id)).exists? || joins(:slugs).where(slug_history_clause(id)).exists?
end

private
Expand Down

0 comments on commit 31b573f

Please # to comment.