Permalink
Browse files

Explicit search by username in email string

  • Loading branch information...
1 parent 08fe6e8 commit e16da353765fbc84992fe6a7aa25d3907a572e47 @route route committed Jul 17, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/controllers/dev_log_in_controller.rb
@@ -2,7 +2,7 @@ class DevLogInController < ApplicationController
def log_in
if Rails.env.development? || Rails.env.test?
- user = User.where(["email LIKE ?", params[:login]+'%']).first || (raise "Can't find user '#{params[:login]}'")
+ user = User.where(User.arel_table[:email].matches("#{params[:login]}@%")).first!
sign_in_and_redirect(user)
else
raise "Works only in development or test env"

0 comments on commit e16da35

Please sign in to comment.