I installed the rails 3.2.11 application using Devise for authentication. I want to use ember.js as the mvc framework.
When I run an ajax call on the POST / users.json route, I get 406 invalid.
Here is my ajax call:
urlBase : '/users' signup : (username, email, password, passwordConfirmation) -> $.ajax url: "#{@.get('urlBase')}.json" type: "POST" dataType: "json" data: "user[username]": username "user[email]": email "user[password]": password "user[password_confirmation]": passwordConfirmation success: (data) -> alert('Completed sign up process: '+ JSON.stringify(data)); @errorMsg = "Signed up successfully." error: (jqXHR, textStatus, errorThrown) -> alert "Error completing sign up: " + textStatus + " error: " + errorThrown
Here are the logs:
Started POST "/users.json" for 127.0.0.1 at 2013-01-14 14:38:57 +0100 Processing by Devise::RegistrationsController#create as JSON Parameters: {"user"=>{"username"=>"obo", "email"=>" obo@obo.dv ", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}} (1.3ms) begin transaction User Exists (1.3ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = ' obo@obo.dv ' LIMIT 1 (0.1ms) rollback transaction Completed 406 Not Acceptable in 311ms (ActiveRecord: 2.6ms)
I do not understand why this is happening.
source share