0

这个问题与此处未解决的问题有关。

是否可以使用 Rails 调试器或类似的东西来识别和跟踪实例变量(或其他变量)的来源?

我的行为已@venue被传递到我的Venue show视图中Venue show,但我的应用程序中似乎有@venue其他地方的流氓或重复版本。@venue = Venue.find(params[:id])当我在Venue控制器show操作中注释掉时,show视图仍然有效,但它应该会引发错误。我需要追踪这个副本。

4

1 回答 1

0

take a look at Better Errors. There is a railscast with all the details. Just install

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
end

You need the binding_of_caller gem for the extra functionality

For any line of the stack trace you can view the local and instance variables at any point in the stack. It also has an interactive prompt that you can use at any point in the stack trace. I've been using it for a few months and It has really helped me out.

You will easily be able to trace what is going on with @venue and its duplicates.

于 2013-06-15T20:38:18.553 回答