【发布时间】:2014-02-19 09:26:50
【问题描述】:
我正在尝试创建一个需要令牌才能使用的 api。每次调用页面时,我都会在控制器中使用此 before_filter 检查令牌是否存在:
def restrict_access_token
authenticate_or_request_with_http_token do |token, options|
ApiKey.exists?(access_token: token)
end
end
找到 apikey 后,我想增加 ApiKey 表中的计数列。
我正在寻找模型中的回调,该回调在找到 apikey 时触发,但在这种情况下似乎不起作用。
有什么想法吗?
【问题讨论】:
标签: ruby-on-rails api authentication token