0
0
Fork 0

Fix tagged param not being normalized before querying tags (#10249)

This commit is contained in:
Eugen Rochko 2019-03-13 13:02:13 +01:00 committed by GitHub
parent d4ef90eae3
commit 06663fcf87
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 4 deletions

View file

@ -72,6 +72,14 @@ class Tag < ApplicationRecord
.limit(limit)
.offset(offset)
end
def find_normalized(name)
find_by(name: name.mb_chars.downcase.to_s)
end
def find_normalized!(name)
find_normalized(name) || raise(ActiveRecord::RecordNotFound)
end
end
private