Created
February 28, 2009 05:30
-
-
Save kastner/71887 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
def create | |
@user = User.new(params[:user]) | |
pw_match = params[:user][:password] == params[:password_confirmation] | |
if pw_match && @user.save | |
flash[:notice] = "User created" | |
redirect_to admin_url | |
else | |
@user.errors.add(:password, "doesn't match conformation") unless pw_match | |
render :action => "new" | |
end | |
end | |
def enable | |
@user = User.find(params[:id]) | |
if @user.enable | |
flash[:notice] = 'User enabled' | |
else | |
flash[:notice] = 'There was a problem enabling the user' | |
end | |
redirect_to user_url # yes reload the page beotch! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment