fixed query function to go through mongomapper instead of custom

This commit is contained in:
danielvincent 2010-09-18 16:42:07 -07:00
parent 2efde8a841
commit e9a3f46fbd

View file

@ -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