Authlogic gotchas
22.02.2011 20:28
There are two. First one: Authlogic assumes that you want to log your users in with http basic authentication. If you have a staging server protected by basic auth you will get random SQL queries with “WHERE email LIKE LOWER(your_http_auth_login)”.
Solution:
class UserSession < Authlogic::Session::Base allow_http_basic_auth false # ... end
Second one: Authlogic provides its own email validation. If you’re using rails3_acts_as_paranoid the deleted_at field will not be taken into account. Resulting in validation errors for emails that exist, but the account has been deleted.
Solution:
class User < ActiveRecord::Base acts_as_authentic do |c| c.validate_email_field = false end validates_uniqueness_of :email, :scope => :deleted_at end
Fixed.
