Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Start of final refactoring steps
def redeem
result = nil
Invite.transaction do
if mark_invite_redeemed == 1
# Create the user if we are redeeming the invite and the user doesn't exist
result = create_user_if_missing
# If there are topic invites for private topics
allow_access_to_private_topics(result)
# Check for other invites by the same email. Don't redeem them, but approve their
# topics.
approve_topic_invitations(result)
send_welcome_message(result)
# Notify the invitee
notify_invitee(result)
else
# Otherwise return the existing user
result = get_existing_user
end
end
result
end
private
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment