improved search methods

This commit is contained in:
albert
2013-01-11 17:13:55 -05:00
parent c7ffda81bf
commit 72b7651169
14 changed files with 93 additions and 4 deletions

View File

@@ -32,6 +32,18 @@ class UserFeedback < ActiveRecord::Base
q = q.for_user(params[:user_id].to_i)
end
if params[:user_name]
q = q.where("user_id = (select _.id from users _ where lower(_.name) = ?)", params[:user_name].downcase)
end
if params[:creator_id]
q = q.where("creator_id = ?", params[:creator_id].to_i)
end
if params[:creator_name]
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].downcase)
end
q
end
end