Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:02:20+00:00 2026-05-25T12:02:20+00:00

I am trying to do Ajax login with Devise, as explained here: http://jessehowarth.com/2011/04/27/ajax-login-with-devise#comment-5 (see

  • 0

I am trying to do Ajax login with Devise, as explained here: http://jessehowarth.com/2011/04/27/ajax-login-with-devise#comment-5 (see comment from jBeasley).

My controller is attempting to return

class Users::SessionsController < Devise::SessionsController
  def failure
    render :json => {:success => false, :errors => ["Login failed."]}
  end
end

which results in this error:

NameError (wrong constant name ["{\"success\":false,\"errors\":[\"Login failed.\"]}"]Controller):

and Firebug showing [500 Internal Server Error].

How can I fix this? I am running Rails 3.1 and devise 1.4.5.

Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:02:20+00:00Added an answer on May 25, 2026 at 12:02 pm

    Did you do the step recommended by Jeff Poulton in comment #4? The :recall option in 1.4.5 looks to be completely incompatible to older versions. It now requires you send the controller, whereas in the tutorial you’re following he just sends the action (the old way).

    In your case, :recall => :failure must be changed to :recall => "users/sessions#failure" in Devise 1.4.5.

    This is because of the way the controller for the failure action is determined. In older versions, it was simply pulled from the params.

    def recall_controller
      "#{params[:controller]}.camelize}Controller".constantize
    end
    
    # called via recall_controller.action(warden_options[:recall]).call(env)
    

    In 1.4.5, it expects a string specifying the controller and action, in the style of routes:

    def recall_app(app)
      controller, action = app.split('#')
      controller_name = ActiveSupport::Inflector.camelize(controller)
      controlller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
      controller_klass.action(action)
    end
    
    # called via recall_app(warden_options[:recall]).call(env)
    

    It would seem as though your app is actually passing the JSONified hash of options to recall_app, which, lacking a ‘#’, isn’t being split, and the entire string is concatenated to “Controller” to attempt to ascertain the failure controller’s class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to replace a rather clumpsy ajax-login of Magento from an external
i've been trying to login through AJAX but somehow its not working. my controller
Trying to implement Ryan's JS implementation of the facebook login, via his Railscast: http://railscasts.com/episodes/360-facebook-authentication
I'm trying to make a login page using html, ajax & ASP.NET.The data is
I'm trying to run .ajax and insert a data element from the onClick of
I am trying to bring up the HTTP authentication box for handling my login.
I have an example where I am trying to create an AJAX login using
I'm trying to submit a simple login form via ajax on a jQuery Mobile
I am trying to make a ajax call to other domain locally from my
I am trying to call a servlet from jQuery's .ajax() function. At the moment

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.