Ruby on rails 3 设计:在错误的令牌上覆盖自定义json的输出

Ruby on rails 3 设计:在错误的令牌上覆盖自定义json的输出,ruby-on-rails-3,devise,Ruby On Rails 3,Devise,为什么??我在哪里可以克服这种行为?在这种情况下,我想显示自定义json 另外,我正在使用无会话的令牌身份验证自定义failureApp帮助了我 类CustomFailureApp

为什么??我在哪里可以克服这种行为?在这种情况下,我想显示自定义json


另外,我正在使用无会话的令牌身份验证

自定义failureApp帮助了我

类CustomFailureApp def json_故障 self.status=401 self.content_type='json'
self.response_body=“{'state':{'code':1,'messages'=['authentication error']}”//自定义failureApp帮助了我

类CustomFailureApp def json_故障 self.status=401 self.content_type='json'
self.response_body=“{'state':{'code':1,'messages'=['authentication error']}}”//这篇博文可能有用:我看到了,我有类似的代码,但找不到它为什么不起作用。这篇博文可能有用:我看到了,我有类似的代码,但找不到它为什么不起作用。
I want to show all models by request http://server/api/art/show.json?auth_token=correct_token
class ArticlesController < ApplicationController

  before_filter :authenticate_user!

  def show
    arts = Article.all
    render :json => {:state => {:code => 0}, :data => arts}
  end

  def new

  end
end
In logs i see that it redirected me to http://server/users/sign_in.json