I've spent way too much time trying to replace the default "404" page for this rails app. From what I've learned, the mechanism to trap "url not found" issues changed in Rails >= 3, and may be broken. At least I wasn't able to get custom, dynamic, "404" pages to work.
One thing that *almost* worked was adding a low-priority routing rule to the very bottom of my routes.rb file, that targeted the controller and view for an error page that I created. Doing that did cause my custom "404" page to display, but it also broke the ability of the administrator to log on to the site.
The only suggestion that I found that actually worked 100% was a suggestion to generate a static 404 html file using rake. The following Rakefile uses the curl command to retrieve the markup for my 404 page, and it stores it in /public/404.html. The page is not dynamic, but it's at least more attractive than the default.
task :default do print "Updating 404 page\n" `curl --silent http://localhost:3000/error_404 -o ../public/404.html` end
This solution is adapted from from Tony Edgecombe's stackoverflow answer.
If it is actually possible to trap "url not found" conditions in Rails 3.1.1, please feel free to submit a comment explaining how. Thanks!
|How to decompile Java code with JetBrains IntelliJ IDEA (2018.2.3, Windows 10)||October 5, 2018|
|Java Programming Tip: SWT Photo Frame Program||October 31, 2016|
|Vault 3 (Desktop) Version 1.63 Released||September 9, 2016|
|"Compliance with Court Orders Act of 2016"||April 9, 2016|
|Disable "Visual Voicemail" on Android / T-Mobile||January 17, 2016|
|IPv6 Humor||December 10, 2015|
|Java Programming Tip: Specify the JVM time zone||December 7, 2015|