Created
February 8, 2019 09:00
-
-
Save Alphabetus/aeb1faf4ab5c0e871584b85930428f17 to your computer and use it in GitHub Desktop.
[DEVISE] Overriding Registrations Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this file should be into "/controllers/" | |
# We call RegistrationsController extending Devise Registrations controller for starters | |
class RegistrationsController < Devise::RegistrationsController | |
# we override the method to define whatever we want here. | |
def after_update_path_for(resource) | |
edit_registration_path(resource) | |
end | |
end | |
# NOTE: | |
# To make this magic work you also need to define your routes to call the right controller otherwise it will just void | |
# this entire class i believe. It just doesnt work without routes defined. We need to tell routes to use this controller. | |
# Period! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by defining 'controllers: {}' we force the changes to be used! | |
devise_for :users, controllers: {registrations: 'registrations'}, path: '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment