title: how do I reload a model in rails console?
body: <pre><code>&gt; rvm list
  rvm rubies
  
  =* ruby-1.9.2-p290 [ i686 ]
     ruby-1.9.3-p194 [ i686 ]
  
  &gt; rails -v
  Rails 3.1.1
  </code></pre>
  
  <p>Related, but didn't answer: <a href="https://stackoverflow.com/questions/6602897/is-there-a-rails-console-command-rails-3-to-reload-changed-code">Is there a Rails Console command (Rails 3+) to reload changed code?</a></p>
  
  <p>I'm using the Rails console to try and figure out why a method in my model isn't being called. The model is in ./app/models/product.rb. I'm changing a method from being called as <code>self.trim_history</code> to <code>trim_history</code>. I'm still wrapping my head around when to call a method as <code>self.do_stuff</code> or just <code>do_stuff</code>. </p>
  
  <p>Well in the course of figuring this out I've run into a problem with <code>reload!</code>. My understanding was that <code>reload!</code> would load all the models and controllers again, but that doesn't seem to be working. When I debug my code, the line that I've changed to be <code>do_stuff</code> is still showing as <code>self.do_stuff</code> in the debugger. </p>
  
  <p>I've attempted to solve this with <code>reload!</code>, no fix. I've reloaded the object from the database after reloading, no fix. I've loaded the model directly with <code>load './app/models/product.rb'</code>, then loaded the object from the db, no fix. I've verified that the object is being changed with <code>tail</code>. </p>
  
  <p>What's the best way to reload a model in the rails console? Do I have to re-start the console every time my model code changes? Is there some way to just dump all of the existing models and their code without reloading the console? </p>
  
  <p><strong>Edit</strong>: this got stranger. I now suspect that my code is being reloaded but the debugger is not reflecting the new code. When I step through the code, the old code is there, but the new code is being executed. I tested this by adding a <code>raise</code> -- the <code>raise</code> never shows in the debugger but it is raised. Wat?</p>
  
  <p>Is there something I need to do with the debugger to get it to see the reloaded code? This looks like a bug... </p>