]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Fix tab breakage and make key update as zoom level changes.
[rails.git] / app / models / user.rb
index 83a8194ddb78b6ed2389df29a7ee5f5e3ff0b43e..2ad45e8acd7d87ae6e63d01583548e3bfe9b9900 100644 (file)
@@ -72,7 +72,7 @@ class User < ActiveRecord::Base
     return el1
   end
 
-  def nearby(radius = 50)
+  def nearby(radius = 50, num = 5)
     if self.home_lon and self.home_lat 
       gc = OSM::GreatCircle.new(self.home_lat, self.home_lon)
       bounds = gc.bounds(radius)
@@ -82,7 +82,7 @@ class User < ActiveRecord::Base
     else
       nearby = []
     end
-    return nearby
+    return nearby.first(num)
   end
 
   def distance(nearby_user)
@@ -93,7 +93,7 @@ class User < ActiveRecord::Base
     res = false
     @new_friend = new_friend
     self.friends.each do |friend|
-      if friend.user_id == @new_friend.user_id
+      if friend.friend_user_id == @new_friend.id
         return true
       end
     end