我想使用条件来运行基于请求类型的语句,但我无法在生产中重现错误来查看请求是什么,但我正在考虑这样做:
def save_path
if request.method == 'GET'
# don't save the timeout path or else the user has no obvious way to log in
session[:desired_path] = request.url unless request.url =~ /#{timeout_path}$/
end
end所以,基本上我想说,如果请求的方法是一个GET请求,那么这一行应该运行,但不知道我的条件设置是否正确。在这方面的任何帮助都将非常感谢。
发布于 2021-10-14 17:48:34
https://stackoverflow.com/questions/69574960
复制相似问题