Commit 0124ae18c594fbc7c40bcf80e44a9feb0b9cf977

Authored by Dmitriy Zaporozhets
1 parent ed82ab41

Fix User#by_username_or_id for postgres

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/user.rb
@@ -198,7 +198,7 @@ class User &lt; ActiveRecord::Base @@ -198,7 +198,7 @@ class User &lt; ActiveRecord::Base
198 end 198 end
199 199
200 def by_username_or_id(name_or_id) 200 def by_username_or_id(name_or_id)
201 - where('username = ? OR id = ?', name_or_id, name_or_id).first 201 + where('users.username = ? OR users.id = ?', name_or_id, name_or_id.to_i).first
202 end 202 end
203 203
204 def build_user(attrs = {}, options= {}) 204 def build_user(attrs = {}, options= {})