我将设计 2.2.2 与 rails 3.2.11 一起使用
我将设计与 ajax 请求一起使用
我更改了以下配置initializers/devise.rb
config.navigational_formats = [:json, :html]
config.http_authenticatable_on_xhr = false
当我提交一个空的登录请求时,我希望得到一个带有错误哈希的 json 响应,但我得到的是 500(请参阅下面的跟踪)(它适用于注册请求)
这是我的路线(没什么特别的)
devise_for :users
痕迹:
Started POST "/users/sign_in.json" for 127.0.0.1 at 2013-01-27 13:33:45 +0100
Processing by Devise::SessionsController#create as JSON
Parameters: {"user"=>{"email"=>"", "password"=>"[FILTERED]"}}
Completed 401 Unauthorized in 1ms
Processing by Devise::SessionsController#new as JSON
Parameters: {"user"=>{"email"=>"", "password"=>"[FILTERED]"}}
Completed 500 Internal Server Error in 40ms
NoMethodError (undefined method `users_url' for #<Devise::SessionsController:0x007fe88ddd9550>):