Heroku ·

Rails on Heroku Notes – some Asset Pipeline and a Frame issue

A tiny Rails asset pipeline thing if you are into bookmarklets

This is more a general Rails issue rather than a Heroku issue, but I ran into the problem while deploying to heroku so I’m including it.
Rails 3 generated digest as well as undigested version of your assets. Rails 4 no longer does that. For many applications that
doesn’t matter but if you need to access your assets directly via file name it becomes a big problem. In my case I need
to be able to access a javascript file for a bookmarklet. The proposed solution is that you put those kinds of files directly
into the public directly. However, I needed to make use of the asset pipeline to take advantage of Rails JST capabilities.
If you run into the same problem take a look at
Non-stupid non-digest assets in Rails 4 by Alex Speller. It saved
me a ton of time and fixed a major headache.

Just in case you want to be framed


It turns out that X-Frame-Options is set to ‘SAMEORIGIN’ by default in Rails 4. If you want your content to be framed then you’ll need to set the headers:


  config.action_dispatch.default_headers = {
    'X-Frame-Options' => 'ALLOWALL'
  }
</pre>