Skip to content

Instantly share code, notes, and snippets.

@jcap49
Last active December 26, 2015 06:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcap49/7111076 to your computer and use it in GitHub Desktop.
Save jcap49/7111076 to your computer and use it in GitHub Desktop.
class CustomUsersController < Devise::RegistrationsController
def new
super
end
def create
build_resource(sign_up_params)
if resource.save
set_text_message
update_text_message_user_id(@text_message)
sanitize_phone_number(@text_message)
send_welcome_text_message(@text_message.phone_number)
execute_text_message_worker(@text_message.id, @text_message.send_time, @text_message.user_id)
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_navigational_format?
sign_up(resource_name, resource)
respond_with resource, :location => after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
expire_session_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment