From e9a3f46fbda8fcb749535103a07da0c63ba46221 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Sat, 18 Sep 2010 16:42:07 -0700 Subject: [PATCH] fixed query function to go through mongomapper instead of custom --- app/models/person.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index 1e2a7b18d..aac7b23ae 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -34,11 +34,8 @@ class Person validates_format_of :url, :with => /^(https?):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*(\.[a-z]{2,5})?(:[0-9]{1,5})?(\/.*)?$/ix - def self.search(query) - Person.all('$where' => "function() { return this.diaspora_handle.match(/^#{query}/i) || - this.profile.first_name.match(/^#{query}/i) || - this.profile.last_name.match(/^#{query}/i); }") + Person.all('profile.first_name' => /^#{query}/) | Person.all('profile.last_name' => /^#{query}/) end def real_name