Devise Registration#update via JS in Rails
I want to submit the form remotely to the registrations#update action, but this isn't working with the default response from Devise, which uses the following from the RegistrationsController:
respond_with resource, :location => after_update_path_for(resource)
The above tries to redirect to the default route instead of rendering the update.js.erb file. I am able to overwrite the action and have it work with the following change:
respond_to do |format| format.html format.js end
Simply had to add a line to the RegistrationsController so that Devise knows to respond_to both html and js.
class RegistrationsController < Devise::RegistrationsController respond_to :html, :js end
Reading up on how respond_with really helped. Couple of good links: