OSDN Git Service

Fix User#by_username_or_id for postgres
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 26 Dec 2013 08:09:15 +0000 (10:09 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 26 Dec 2013 08:09:15 +0000 (10:09 +0200)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/models/user.rb

index cdf6592..7767d26 100644 (file)
@@ -198,7 +198,7 @@ class User < ActiveRecord::Base
     end
 
     def by_username_or_id(name_or_id)
-      where('users.username = ? OR users.id = ?', name_or_id, name_or_id.to_i).first
+      where('users.username = ? OR users.id = ?', name_or_id.to_s, name_or_id.to_i).first
     end
 
     def build_user(attrs = {}, options= {})