RailsApps/rails3-bootstrap-devise-cancan

Cannot handle error in sign up

netwire88 opened this issue · 1 comments

When user signs up via "Request Invitation" , if there's an error such as duplicate email, RegistrationController.create doesn't return an xhr.error

(render(:partial => 'thankyou', :layout => false) && return) if request.xhr?

And thus this code in application.js doesn't handle error correctly.

$.ajax({
type: "POST",
url: "/users",
data: dataString,
success: function(data) {
$('#request-invite').html(data);
loadSocial();
},
});

and this isn't called:

if ($('.alert-error').length > 0) {
$("#request-invite").modal('toggle');
}

Sorry, just realized it was added to wrong github