如果您发送的是正确的标题,则不需要执行“ ActiveSupport :: JSON.depre”-rails会为您完成。
您需要在帖子中设置以下标题。
Content-Type: application/jsonAccept: application/json
422表示不可处理实体-通常表示验证失败。
您应该能够拥有。如果不能,则说明标题设置不正确。
def create if user = User.authenticate(params["email"], params["password"]) session[:user_id] = user.id render :json => "{"r": "t"}" + req else render :json => "{"r": "f"}" endend


