]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Wait until after rails has initialise I18n to preload the resources
[rails.git] / app / models / user.rb
index ef0dcc4b0f150a9f5c99942b8a819938e07b24e7..2e312119f8d13e669e7b941890b65932d18ca837 100644 (file)
@@ -142,14 +142,7 @@ class User < ActiveRecord::Base
   end
 
   def is_friends_with?(new_friend)
-    res = false
-    @new_friend = new_friend
-    self.friends.each do |friend|
-      if friend.friend_user_id == @new_friend.id
-        return true
-      end
-    end
-    return false
+    self.friends.where(:friend_user_id => new_friend.id).exists?
   end
 
   ##