I am using devise gem version 4.1.1 in my rails project and in my /users/edit page I want to redirect to the same page after the user changes his password instead of redirecting to the root_path. I googled around and found this link devise github wiki
I did make the changes accordingly and my registrations controller is as follows
class RegistrationsController < Devise::RegistrationsController
protected
def after_update_path_for(resource)
edit_user_registration_path
end
end
and in routes.rb I added the registrations controller
devise_for :users, controllers: { confirmations: "confirmations", registrations: "registrations"}
But still for some reason I am not able to redirect to the same page and it still redirects to root_path. Am I missing something?
EDIT 1: I am also using backbone-rails gem to use backbone.js inside my rails app. The router class of backbone.js is as follows
class Pulse.Routers.MainRouter extends Backbone.Router
routes:
"new" : "newBranch"
"" : "analytics"
"analytics" : "analytics"
"voices" : "manageVoice"
"branches" : "manageBranch"
"tablets" : "manageTablet"
"branch/:branchId/tablet/:tabletId/edit" : "tabletEdit"
"branch/:branchId/tablet/new" : "tabletAdd"
"timeline" : "timeline"
"reports" : "reports"
"questions" : "manageQuestion"
"users" : "users"
":id/edit" : "edit"
":id" : "show"
".*" : "index"
followed by the corresponding functions that renders the views and my routes.rb for the user is as follows
authenticated :user do
root 'static_pages#home', as: :authenticated_root
end
root 'static_pages#landing'
Whenever I update the profile of the user I can see the browser address as "/users/edit" but the index page is getting displayed which is due backbone.js router file. I can see that the control is going to the router file after I inserted a console.log statement there. So is there anyway that I can bypass the backbone router and display the '/users/edit' page after user updates his profile?