Skip to content

Instantly share code, notes, and snippets.

@chad
Forked from kastner/controller_example.rb
Created February 28, 2009 06:04
Show Gist options
  • Save chad/71891 to your computer and use it in GitHub Desktop.
Save chad/71891 to your computer and use it in GitHub Desktop.
def create
@user = User.new(params[:user])
pw_match!
if @user.save
flash[:notice] = "User created"
redirect_to admin_url
else
render :action => "new"
end
end
def pw_match!
matched = params[:user][:password] == params[:password_confirmation]
@user.errors.add(:password, "doesn't match conformation") unless matched
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment