Skip to content

Instantly share code, notes, and snippets.

@scottmagdalein
Created July 25, 2012 20:15
Show Gist options
  • Save scottmagdalein/3178346 to your computer and use it in GitHub Desktop.
Save scottmagdalein/3178346 to your computer and use it in GitHub Desktop.
users_controller
def new
@user = User.new(params[:user])
end
def create
@user = User.new(params[:user])
if params[:key].present?
invite = Invite.find_by_key(params[:key])
end
if @user.save
auto_login @user
Following.new(user_id: @user_id, following_id: invite.user_id)
redirect_to edit_user_path(@user), :notice => "You're in!"
else
render :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment