remove trailing whitespaces ❤️

This commit is contained in:
Gosha Arinich
2013-02-25 19:42:20 +03:00
parent b50e0536c7
commit cafc75b238
383 changed files with 4220 additions and 2221 deletions

View File

@ -2,17 +2,17 @@ class UserSearch
def self.search term, topic_id = nil
sql = User.sql_builder(
"select id, username, name, email from users u
"select id, username, name, email from users u
/*left_join*/
/*where*/
/*order_by*/")
if topic_id
sql.left_join "(select distinct p.user_id from posts p where topic_id = :topic_id) s on s.user_id = u.id", topic_id: topic_id
end
if term.present?
if term.present?
sql.where("username_lower like :term_like or
to_tsvector('simple', name) @@
to_tsquery('simple',
@ -25,7 +25,7 @@ class UserSearch
sql.order_by "case when username_lower = :term then 0 else 1 end asc"
end
if topic_id
sql.order_by "case when s.user_id is null then 0 else 1 end desc"
end