From b81804306e69b71a141e32ffafe34c091ca9abdc Mon Sep 17 00:00:00 2001 From: Toks Date: Fri, 9 Aug 2013 13:25:37 -0400 Subject: [PATCH] Fix artist excerpt with wildcard searches --- app/logical/post_sets/post.rb | 4 ++-- app/models/artist.rb | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index c397fb267..bbf8ef334 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -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 diff --git a/app/models/artist.rb b/app/models/artist.rb index 6a7eada16..c32ad8f6f 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -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?