Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy would I have to restart rails every time to test a 404.html page here?
    primarykey
    data
    text
    <p>I'm trying to work out why when working on a <code>404</code> page on a rails app I'm working, the only way to see changes I've made to the html on the page is to physically restart the webserver with a <code>ctrl-C</code> followed by a call to <code>script/server</code>.</p> <p>As far as I can tell, I can't see anything particularly wrong with the <code>development.rb</code> config file here:</p> <pre><code># Settings specified here will take precedence over those in config/environment.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the webserver when you make code changes. config.cache_classes = false # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_view.debug_rjs = true config.action_controller.perform_caching = false # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_deliveries = false # add rack bug # config.middleware.use "Rack::Bug" # this disables the caching for comatose, not the rest of the app # config.disable_caching = true config.action_mailer.default_url_options = { :host =&gt; "localhost:3000" } config.gem "thoughtbot-factory_girl", :lib =&gt; "factory_girl", :source =&gt; "http://gems.github.com" </code></pre> <p>This alone won't display the error pages locally, so in <code>application_controller.rb</code> I've aliased <code>rescue_action_locally</code> to the <code>rescue_action_in_public</code> method, to stop me seeing the stacktrace:</p> <pre><code> # this method allows you to test 404 and 500 pages locally alias_method :rescue_action_locally, :rescue_action_in_public </code></pre> <p>This here shows me the error page once, but then caches it so that future reloads show the state of the html file when the server was loaded.</p> <p>The log output doesn't show me any weird caching behaviour - it's getting a request for a non-existent resource, not finding anything, then rendering the html page as required:</p> <pre><code> chrisadams@r220-101-174-100 ~/RailsApps/annoying_app &gt; script/server --debugger =&gt; Booting Mongrel =&gt; Rails 2.3.2 application starting on http://0.0.0.0:3000 =&gt; Debugger enabled =&gt; Call with -d to detach =&gt; Ctrl-C to shutdown server SQL (0.2ms) SET SQL_AUTO_IS_NULL=0 Processing ApplicationController#index (for 127.0.0.1 at 2009-12-28 19:23:27) [GET] ActionController::RoutingError (No route matches "/non-existent-resource" with {:method=&gt;:get}): Rendering /Users/chrisadams/RailsApps/annoying_app/public/404.html (404 Not Found) </code></pre> <p>The 404.html is totally static, without any ERB in there at all, and this static html page is what isn't changing between page refreshes.</p> <p>What am I doing wrong here? This is driving me crazy!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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