Fix artist excerpt with wildcard searches

This commit is contained in:
Toks
2013-08-09 13:25:37 -04:00
parent a1ab9603db
commit b81804306e
2 changed files with 6 additions and 2 deletions

View File

@@ -31,11 +31,11 @@ module PostSets
end
def has_artist?
tag_array.any? && ::Artist.name_matches(tag_string).active.exists?
tag_array.any? && ::Artist.named(tag_string).active.exists?
end
def artist
::Artist.name_matches(tag_string).active.first
::Artist.named(tag_string).active.first
end
def pool_name

View File

@@ -248,6 +248,10 @@ class Artist < ActiveRecord::Base
where("name LIKE ? ESCAPE E'\\\\'", stripped_name)
end
def named(name)
where("name = ?", normalize_name(name))
end
def any_name_matches(name)
stripped_name = normalize_name(name).to_escaped_for_sql_like
if name =~ /\*/ && CurrentUser.user.is_builder?