Skip to content

Commit

Permalink
Fix exists? to behave the same as find for numeric slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sethbaugh authored and parndt committed Jun 30, 2018
1 parent 9cd4ce2 commit a06bee8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/friendly_id/finder_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def find(*args)

# Returns true if a record with the given id exists.
def exists?(conditions = :none)
return super unless conditions.friendly_id?
exists_by_friendly_id?(conditions)
return super if conditions.unfriendly_id?
return true if exists_by_friendly_id?(conditions)
super
end

# Finds exclusively by the friendly id, completely bypassing original
Expand Down

0 comments on commit a06bee8

Please sign in to comment.