即使用户已登录,我也略微修改了Devise的会话控制器,使其响应201代码:
class SessionsController < Devise::SessionsController
# POST /resource/sign_in
def create
resource = warden.authenticate!(auth_options)
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
resource[:is_admin] = resource.is_admin?
#respond_with resource, :location => after_sign_in_path_for(resource)
render :status => :created, :location => '/#/editor', :json => resource
end
end
(最后一行替换了注释的那一行),但它继续使用302状态代码而不是201来响应身份验证JSON。我做错了什么?