I have a problem using devise with an AJAX login. I'm using the :remote => true
option and the jQuery version of the javascript helpers (https://github.com/rails/jquery-ujs).
Ehen the user enters the correct informations, my create.js.erb inside the sessions view is rendered. This is ok, 'cause i can redirect my user using JS in this file. But when an error occurs, e.g. the user enters false information, only the flash messages are in the response with an error code 401 - Unauthorized
. So, no view or create.js.erb or sth else is rendered.
But I want to handle this message, by displaying it on the side, so that the users gets some feedback, whats wrong.
I also tried to implement my own custom controller with respond_to :js
, and playing with the :recall
method of the warden authentication. But it doesn't work.
Does anybody know some best practices to solve this problem? Or should I avoid this helper methods and just use pure jQuery for the ajax calls?
thx, tux