Fix artist excerpt with wildcard searches
This commit is contained in:
@@ -31,11 +31,11 @@ module PostSets
|
|||||||
end
|
end
|
||||||
|
|
||||||
def has_artist?
|
def has_artist?
|
||||||
tag_array.any? && ::Artist.name_matches(tag_string).active.exists?
|
tag_array.any? && ::Artist.named(tag_string).active.exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
def artist
|
def artist
|
||||||
::Artist.name_matches(tag_string).active.first
|
::Artist.named(tag_string).active.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def pool_name
|
def pool_name
|
||||||
|
|||||||
@@ -248,6 +248,10 @@ class Artist < ActiveRecord::Base
|
|||||||
where("name LIKE ? ESCAPE E'\\\\'", stripped_name)
|
where("name LIKE ? ESCAPE E'\\\\'", stripped_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def named(name)
|
||||||
|
where("name = ?", normalize_name(name))
|
||||||
|
end
|
||||||
|
|
||||||
def any_name_matches(name)
|
def any_name_matches(name)
|
||||||
stripped_name = normalize_name(name).to_escaped_for_sql_like
|
stripped_name = normalize_name(name).to_escaped_for_sql_like
|
||||||
if name =~ /\*/ && CurrentUser.user.is_builder?
|
if name =~ /\*/ && CurrentUser.user.is_builder?
|
||||||
|
|||||||
Reference in New Issue
Block a user