gpt4 book ai didi

ruby-on-rails - before_filter 中未定义的参数和 session 哈希

转载 作者:数据小太阳 更新时间:2023-10-29 08:02:16 26 4
gpt4 key购买 nike

有没有人知道为什么,当通过调用 debugger 在一个名为 before_filter 的方法中使用 ruby-debug 时,params session 哈希未定义?

class MyExampleController < ActionController::Base

before_filter :test_hashes

def test_hashes
pp session
pp params #both work as expected..

debugger #calling the debug console
end

def index
#whatever..
end

end

#the rdb console
(rdb:5) pp params
NameError Exception: undefined local variable or method 'params' for #<ActionController::Filters::BeforeFilter:0x3eafda0>
(rdb:5) pp session
NameError Exception: undefined local variable or method 'session' for #<ActionController::Filters::BeforeFilter:0x3eafda0>

这是正常行为还是我做错了什么?

最佳答案

试着放一个 b.s.调用调试器后的行,看看会发生什么。

关于ruby-on-rails - before_filter 中未定义的参数和 session 哈希,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/925579/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com