Using your own registration controller with Devise

I use the program for authentication. I wanted to use my own registration controller, not the one that is developing for internal use. So, let's go and follow the instructions given here, https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password

Copy the registrations_controller.rb file from the Devise program (do not forget to copy the controller from the same version as your design) Put this in the directory / application / controllers.
In config / routes.rb add: controllers => {: registrations => "registrations"} to your devise_for root.
Make sure you name the file registrations_controller.rb
Change the first line: class Devise :: RegistrationsController <ApplicationController for the class RegistrationsController <ApplicationController

I am using version 1.1 and I copied the registrations_controller.rb file from here. https://github.com/plataformatec/devise/blob/v1.1/app/controllers/devise/registrations_controller.rb

Now when I find the new action of the registration controller, I get the following error

NoMethodError (undefined method `new_with_session' for User:Class):
app/controllers/registrations_controller.rb:71:in `build_resource'
app/controllers/registrations_controller.rb:8:in `new'

My registrations_controller.rb , , . ? .

+3

Source: https://habr.com/ru/post/1793515/


All Articles