Skip to content

Instantly share code, notes, and snippets.

@kastner
Created February 28, 2009 05:30
Show Gist options
  • Save kastner/71887 to your computer and use it in GitHub Desktop.
Save kastner/71887 to your computer and use it in GitHub Desktop.
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