Skip to content

Commit

Permalink
Revert "Case Insensitivity for id, fixes #785 (#787)"
Browse files Browse the repository at this point in the history
This reverts commit f576251.
  • Loading branch information
parndt committed Nov 10, 2020
1 parent c6b29bd commit 63b496c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ suggestions, ideas and improvements to FriendlyId.

## Unreleased

* Revert "Make `first_by_friendly_id` case insensitive using `downcase`" ([#951](https://github.com/norman/friendly_id/pull/951))

## 5.4.1 (2020-11-06)

* Fix unexpected `:slug` error on valid, unpersisted model ([#952](https://github.com/norman/friendly_id/pull/952))
Expand Down
2 changes: 1 addition & 1 deletion lib/friendly_id/finder_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def potential_primary_key?(id)
end

def first_by_friendly_id(id)
find_by(friendly_id_config.query_field => id.downcase)
find_by(friendly_id_config.query_field => id)
end

def raise_not_found_exception(id)
Expand Down
24 changes: 0 additions & 24 deletions test/finders_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,4 @@ def model_class
assert model_class.existing.find(record.friendly_id)
end
end

test 'should find capitalized records with finders as class methods' do
with_instance_of(model_class) do |record|
assert model_class.find(record.friendly_id.capitalize)
end
end

test 'should find capitalized records with finders on relations' do
with_instance_of(model_class) do |record|
assert model_class.existing.find(record.friendly_id.capitalize)
end
end

test 'should find upcased records with finders as class methods' do
with_instance_of(model_class) do |record|
assert model_class.find(record.friendly_id.upcase)
end
end

test 'should find upcased records with finders on relations' do
with_instance_of(model_class) do |record|
assert model_class.existing.find(record.friendly_id.upcase)
end
end
end

0 comments on commit 63b496c

Please sign in to comment.