Ruby on Rails
Friday, May 5, 2017
On May 4, 2017, at 6:02 PM, fugee ohu <fugee279@gmail.com> wrote:Debug helpers/statements go in views or controllers or can be used in either?
You can generally use debuggers anywhere in Ruby code. (most of the community prefers byebug I think, but I can't speak for everyone. I know some who still use pry).
In your views, sometimes I stick a debugging statement in just inside the markup, like so (assuming your view is ERB):
<% byebug %>
The only exceptions to that might be a cached partial, which won't get re-evaluated. To work around such a problem, remove the caching or clear the Rails cache.
-Jason
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment