Skip to content

Commit

Permalink
Merge pull request #497 from GoBoundless/master
Browse files Browse the repository at this point in the history
Performance improvement for finding if a slug is already used or not
  • Loading branch information
norman committed Dec 10, 2013
2 parents 0732bdf + caaa0e2 commit 826d72d
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?
joins(:slugs).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 826d72d

Please # to comment.