2

I'm trying to apply this post ( Devise update user without password ) for users don't need to insert password to update informations. But, I'm very confused where is this controller. Devise don't create any controller in my app/controller folder. I search in all the folders but I cant find.

Where I that controller? I see posts talking about create a new controller, but I just want to modify little things.

Community
  • 1
  • 1
Igor Martins
  • 2,015
  • 7
  • 36
  • 57

2 Answers2

2

You don't edit (or shouldn't) the Devise controllers. Instead you create your own controller and inherent from the Devise controller.

# app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
  def new
    super
  end

  def update
    # add custom update logic here
  end
end

Notice how RegistrationsController inherets from Devise::RegistrationsController. Now you can overide the registration methods (or modify them and call super). Even the page you are referencing about overriding the devise default behavior relies on class inheritance.

JTG
  • 8,587
  • 6
  • 31
  • 38
0

JTG offers good advice, you shouldn't edit the gem directly. As a more direct answer to the question:

To print the folder of your gem:

$ bundle show devise

To open the gem in a text editor ( while being sure not to change anything )

$ bundle open devise
Carl
  • 993
  • 8
  • 14