【发布时间】:2014-01-12 07:50:26
【问题描述】:
在尝试在 Rails 中实现令牌身份验证的过程中,我遇到了这种行为:
class AppController < ActionController::Base
before_filter :restrict_access
def restrict_access
authenticate_or_request_with_http_token do |token, options|
false
end
end
这将按预期拒绝所有请求。
但是,如果我将“false”更改为“return false”,它接受所有请求。
def restrict_access
authenticate_or_request_with_http_token do |token, options|
return false
end
end
这怎么可能?
【问题讨论】:
标签: ruby-on-rails ruby