Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Although I wasn't able to reproduce the problem in Rails 3.2.2, I've run into something like this before. The generic way to hack around this problem in development mode is through an <code>ActionDispatch</code> callback. Add this to <code>config/environments/development.rb</code>:</p> <pre><code>MyApp::Application.configure do ActionDispatch::Callbacks.before do load Rails.root.join('app', 'models', 'staff.rb') end end </code></pre> <p>Anything you do in that block will be executed before each request, so <strong>make sure you're only doing it in development mode</strong>.† Otherwise, you're going to suffer a performance hit in production.</p> <p>I logged a message inside the <code>staff.rb</code> file and within the <code>Staff</code> module itself, and both messages appeared in the log for each request.</p> <hr> <p>† I tried using the <code>to_prepare</code> callback, since that seems to be <a href="http://guides.rubyonrails.org/configuring.html#configuring-action-dispatch" rel="nofollow noreferrer">the documented way to execute code before each request only when <code>cache_classes</code> is false</a>. But that only seemed to execute after restarting the application. There's at least <a href="https://stackoverflow.com/questions/9542600/using-rails-to-prepare-event">one other open Stack Overflow question regarding this</a>, although he's using a slightly different syntax than I used. If you can get <code>to_prepare</code> to work, I'd suggest that instead of <code>before</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload