Created
October 23, 2013 00:52
-
-
Save Breefield/7110720 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserSession < Authlogic::Session::Base | |
validate :check_presence | |
# Without the following method, calling persisted? on UserSession fails, | |
# which is needed for polymorphic_url when called with a UserSession. | |
def destroyed? | |
false | |
end | |
private | |
# If neither email nor password are present, Authlogic adds an error to | |
# :base, but not either field. | |
def check_presence | |
if !email && !password | |
errors.add(:email, 'cannot be blank') | |
errors.add(:password, 'cannot be blank') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment