Sunday, November 28, 2010

authlogic custom conditions for authentication

by sandipransing 0 comments
To Add custom conditions to authlogic finders first of all we need to override authlogic find_by_login method.

class UserSession < Authlogic::Session::Base
  after_validation :check_if_verified
  find_by_login_method :find_by_login_and_deleted_method
end


Then we need to define overridden method inside User model

class User < ActiveRecord::Base
  acts_as_authentic
  def self.find_by_login_and_deleted_method(login)
    find_by_email_and_deleted(login, false)
  end
end


got easy..wooooooo :)
Read More…

Thursday, November 18, 2010

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter