title: How to debug a plugin / gem? (with useful notes to setup and use ruby-debug gem)
body: <p>Is there a way like how we debug models / controllers with logger.debug? Or even a better method?</p>
  
  <p>Thank you!</p>
  
  <p><strong>Edit 1</strong></p>
  
  <p>Using <a href="http://bashdb.sourceforge.net/ruby-debug/home-page.html" rel="nofollow noreferrer">ruby-debug</a> seems like a steep learning curve for me, could anyone point me something similar to logger.debug, perhaps?</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>Alright, I think I started to get a grasp on ruby-debug.</p>
  
  <p>Some useful notes for newbies to setup &amp; use ruby-debug:</p>
  
  <blockquote>
  <pre><code>gem install ruby-debug
  in config/environments/development.rb add
  </code></pre>
    
    <p>include 'ruby-debug'</p>
  
  <pre><code>then just above the code you want to debug add:
  
  debugger
  
  if you need to debug third party plugin / gem, use
  
  include 'ruby-debug'
  debugger
  
  just use ruby script/server to run, no need to add --debugger
  </code></pre>
  </blockquote>
  
  <p><strong>Edit 3</strong></p>
  
  <p>This plugin really helps me out in understanding the flow of Rails application. I highly recommend this to any newbies going pro!</p>
  
  <p>Simply setup ruby-debug, then put debugger code anywhere in your controller under the action your application requested. You will then find great revelation!</p>