Created
December 15, 2011 22:06
-
-
Save JoeWoodward/1483126 to your computer and use it in GitHub Desktop.
This file contains 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
#controller | |
def activate | |
if @user = User.load_from_activation_token(params[:activation_token]) | |
@user.inactive = true | |
@user.activate! | |
login(@user.email, @user.password) | |
else | |
redirect_to login_path, :alert => 'Account has been activated already, please login' | |
end | |
end | |
#User.rb | |
attr_accessor :inactive | |
validates_presence_of :password, :if => :should_be_validated? | |
def should_be_validated? | |
inactive | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment