Skip to content

Instantly share code, notes, and snippets.

@Alphabetus
Created February 8, 2019 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Alphabetus/aeb1faf4ab5c0e871584b85930428f17 to your computer and use it in GitHub Desktop.
Save Alphabetus/aeb1faf4ab5c0e871584b85930428f17 to your computer and use it in GitHub Desktop.
[DEVISE] Overriding Registrations Controller
# 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!
# 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