I have a custom user like such:
class PersonsController < UsersController
end
However, after signing in just fine, when I click “persons/edit”, I get redirected to the login page… I can see in the logs the following:
Processing by Person::RegistrationsController#edit as HTML Completed
401 Unauthorized in 0ms
Then I get redirected to the Login page again, I didn’t lose the session at this point, I could click back on my profile and see the account details.
Just not sure why Devise has issues with the Edit action
I also have the following structure in my registration controller
class Person
class RegistrationsController < Devise::RegistrationsController
end
end
Any help, it’s appreciated it. Thanks.
Actually I found the solution, I had to redefine this method in my custom Person::RegistrationsController
It seems the session doesn’t have a custom “current_person” method, but always a current_user because I’m login in with ‘users/sign_in’ (I wanted a common login point for other custom users in my system). If I login with ‘persons/sign_in’ then this workaround is not needed. For some reason. Im not really sure why, this was the original method from devise’s github repo:
I hope this helps someone in the future, regards.