json post to devise causes 422 / Unprocessable entity

i'm using angular and posting to a RoR back-end, with devise for auth. When I submit a new user for creation, I'm getting the following:

Started PUT "/api/user" for 127.0.0.1 at 2013-11-19 11:38:13 -0600
Processing by Devise::RegistrationsController#create as JSON
  Parameters: {"user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "first_name"=>"alex", "last_name"=>"p"}, "registration"=>{"user"=>{"email"=>"[email protected]", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "first_name"=>"alex", "last_name"=>"p"}}}
   (0.2ms)  BEGIN
  User Exists (0.8ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = '[email protected]' LIMIT 1
   (0.2ms)  ROLLBACK
Completed 422 Unprocessable Entity in 128ms (Views: 0.2ms | ActiveRecord: 7.4ms)

User model:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
  attr_accessible :first_name, :last_name, :email, :password, :password_confirmation, :remember_me, :last_check

end

I can't figure out what's going on. I assume it's something with the parameters I'm sending (or not sending?) but everything seems to be there.


My first thought base on the log is that there is already a user existing with the same email. Otherwise you can use a httpclient (curl or Postman in chrome or Restclient in chrome) to see what the response is.

I'm not too familiar with Angular but if you do have access to the http response just output it in the console. It should tell you the validation errors.