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
为什么??我可以在哪里覆盖这种行为?在这种情况下,我想显示自定义 json
PS我正在使用没有会话的令牌身份验证