Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
rearranged user retrieval
def invited_user
@invited_user ||= get_invited_user
end
def get_invited_user
result = get_existing_user
result ||= create_new_user
result.send_welcome_message = false
result
end
def get_existing_user
User.where(email: invite.email).first
end
def create_new_user
User.create_for_email(invite.email, trust_level: SiteSetting.default_invitee_trust_level)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment