I work with Devise and DeviseInvitable to manage authentication in my application, and I'm having trouble adding AJAX support to update InvitationsController #. The controller in DeviseInvitable looks like this:
# invitations_controller.rb # PUT /resource/invitation def update self.resource = resource_class.accept_invitation!(params[resource_name]) if resource.errors.empty? set_flash_message :notice, :updated sign_in(resource_name, resource) respond_with resource, :location => after_accept_path_for(resource) else respond_with_navigational(resource){ render_with_scope :edit } end end
Does this work well when resource.errors.empty? == true resource.errors.empty? == true and we execute:
respond_with resource, :location => after_accept_path_for(resource)
(that is, the /update.js.erb prompts are displayed and my javascript calls are executed). The problem is that when is resource.errors.empty? == false resource.errors.empty? == false , and we execute:
respond_with_navigational(resource){ render_with_scope :edit }
the server says:
Rendered invitations/update.js.erb (1.4ms)
but my javascript calls are not starting. Can someone explain what respond_with_navigational should do? I worked on the Internet for many hours, and I have not found an explanation for this api anywhere.
Thanks!
source share