fixes to model searches

This commit is contained in:
albert
2013-02-19 12:27:17 -05:00
parent e678427ee7
commit e0fdda3103
21 changed files with 68 additions and 68 deletions

View File

@@ -325,15 +325,15 @@ class Upload < ActiveRecord::Base
q = scoped
return q if params.blank?
if params[:uploader_id]
if params[:uploader_id].present?
q = q.uploaded_by(params[:uploader_id].to_i)
end
if params[:uploader_name]
if params[:uploader_name].present?
q = q.where("uploader_id = (select _.id from users _ where lower(_.name) = ?)", params[:uploader_name].downcase)
end
if params[:source]
if params[:source].present?
q = q.where("source = ?", params[:source])
end