Skip to content

Instantly share code, notes, and snippets.

@mchung
Created March 25, 2009 09:01
Show Gist options
  • Save mchung/85380 to your computer and use it in GitHub Desktop.
Save mchung/85380 to your computer and use it in GitHub Desktop.
class UsersController < ApplicationController
include Clearance::App::Controllers::UsersController
# Override and add in a check for invitation code
def create
@user = User.new params[:user]
invite_code = params[:invite_code]
@invite = Invite.find_redeemable(invite_code)
if invite_code && @invite
if @user.save
@invite.redeemed!
ClearanceMailer.deliver_confirmation @user
flash[:notice] = "You will receive an email within the next few minutes. " <<
"It contains instructions for confirming your account."
redirect_to url_after_create
else
render :action => "new"
end
else
flash.now[:notice] = "Sorry, that code is not redeemable"
render :action => "new"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment