为了了解更多有关Ransack(Gem)如何工作的信息,我开始调试它,这会带我进入控制台:
28: def index
29: debugger
=> 30: @search = ControlCenter.ransack(params[:q])
我想要更深入,所以我输入
(byebug) step
给了我这个输出:
[197, 206] in /Users/xx/.rvm/gems/ruby-2.3.0@xxx/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb
201: def const_missing(const_name)
=> 202: from_mod = anonymous? ? guess_for_anonymous(const_name) : self
203: Dependencies.load_missing_constant(from_mod, const_name)
204: end
查看搜索方法:
def ransack(params = {}, options = {})
Search.new(self, params, options)
end
我无法理解这里发生了什么。两者之间没有电话吗?我如何以ActiveSupport :: Dependencies结束?我没有跟step
的每次通话都没有?