Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Sinatra 中有简单的会话身份验证。但是,我想在每个请求上运行此方法,这样如果用户未登录(例如,未设置用户名的会话变量等),那么它们将被重定向到登录页面。我怎样才能做到这一点?
您可以使用before:
before
before do # authentication end