Fix username searches

This commit is contained in:
Toks
2013-08-10 12:49:25 -04:00
parent a45af927ee
commit 27e54c3f3c
4 changed files with 5 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ class PostAppeal < ActiveRecord::Base
end
if params[:creator_name].present?
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase)
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_"))
end
if params[:post_id].present?

View File

@@ -36,7 +36,7 @@ class PostFlag < ActiveRecord::Base
end
if params[:creator_name].present?
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase)
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_"))
end
if params[:post_id].present?

View File

@@ -71,7 +71,7 @@ class TagSubscription < ActiveRecord::Base
end
if params[:creator_name]
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase)
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_"))
end
q

View File

@@ -36,7 +36,7 @@ class UserFeedback < ActiveRecord::Base
end
if params[:user_name].present?
q = q.where("user_id = (select _.id from users _ where lower(_.name) = ?)", params[:user_name].mb_chars.downcase)
q = q.where("user_id = (select _.id from users _ where lower(_.name) = ?)", params[:user_name].mb_chars.downcase.strip.tr(" ", "_"))
end
if params[:creator_id].present?
@@ -44,7 +44,7 @@ class UserFeedback < ActiveRecord::Base
end
if params[:creator_name].present?
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase)
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase.strip.tr(" ", "_"))
end
if params[:category].present?