Rails 4 blank page on index action
We recently had an issue where Rails 4 was giving a blank page when calling the index
action on some, but not all, controllers.
After some considerable frustration the ever useful @mikespokefire managed to solve it.
Someone who shall remain nameless (but may, or may not, have been me) had configured asset pipeline to point at the same root as the main rails app, which meant that on loading it was trying to find a .js
, .css
, or an image file with that name before loading the normal controller action. And if you're anything like me and used a generator, you probably had more than one of the above.
The solution is as simple as configuring rails to store assets in /assets
using something like the following in application.rb
:
config.assets.prefix = "/assets"
And as if by magic, it now works!