Skip to content

Instantly share code, notes, and snippets.

@giancorzo
Created October 18, 2016 07:40
Show Gist options
  • Save giancorzo/bb1985c78894b24a252b2e1f8f6c7aab to your computer and use it in GitHub Desktop.
Save giancorzo/bb1985c78894b24a252b2e1f8f6c7aab to your computer and use it in GitHub Desktop.
Registration problem
class Users::RegistrationsController < Devise::RegistrationsController
before_filter :configure_permitted_parameters
def create
build_resource(sign_up_params)
resource.save
yield resource if block_given?
if resource.persisted?
if resource.active_for_authentication?
sign_up(resource_name, resource)
MandrillDeviseMailer.new_registration(resource).deliver
respond_with resource, location: after_sign_up_path_for(resource)
else
set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
expire_data_after_sign_in!
respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
set_minimum_password_length
respond_with resource, location: new_user_registration_url
end
end
....
end
devise_for :users,
path: "",
path_names: {
sign_in: "login",
sign_out: "logout",
sign_up: "signup"
},
controllers: {
omniauth_callbacks: 'users/omniauth_callbacks',
registrations: "users/registrations",
sessions: "users/sessions"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment