Skip to content

Instantly share code, notes, and snippets.

View cacciatc's full-sized avatar

Chris Cacciatore cacciatc

View GitHub Profile
@cacciatc
cacciatc / clearance_users_controller_with_invite.rb
Created July 16, 2011 22:56 — forked from mchung/clearance_users_controller_with_invite.rb
Fix: so a user can only use their own invite code
class UsersController < Clearance::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)
# Invite code is present, there is an associated invite, and it is the user's invite
if invite_code && @invite && @invite.email == @user.email