Sunday 4 August 2013

Rails4, Phusion Passenger, asset pipeline problems

Rails 4 has introduced many new and exciting features, but it's very new technology and one of the most important features, asset pipelines is causing many people headaches. If you use Phusion Passenger with Rails 4 and Ruby 2, you may encounter these problems:

  1. Pre-compiled fingerprints used for some assets, but not others.
  2. Mismatch between pre-compiled hashes and the hashes that production assigns (i.e. fingerprint mismatches) not resolved by re-compiling the assets.
Usually you will get a message that looks like this:
ActionController::RoutingError (No route matches [GET]
with the asset following in quotes.

We found that the following helped resolve the problems:
  • Append "RAILS_ENV=production RAILS_GROUPS=assets" to your rake assets:precompile line. I.e.: bundle exec rake assets:precompile RAILS_ENV=production RAILS_GROUPS=assets
In config/environments/production.rb:
  • Make Rails use digest: config.assets.digest = true
  • Enable fallback to assets pipeline: config.assets.compile =true
Hopefully in time Rails 4 pipeline issues will be resolved, but for now, these work-arounds in some environments seem to be the best way to ensure that assets remain served in production.
 

8 comments:

  1. Thanks for sharing, but these steps didn't work for me. Are you aware of an associated Rails or Passenger bug/

    ReplyDelete
    Replies
    1. Not that I am aware of, sorry! Please post here if you solve it so that others can benefit!

      Delete
  2. I found decent information in your article.Pipeline Engineering Contractors I am impressed with how nicely you described this subject, It is a gainful article for us. Thanks for share it.

    ReplyDelete
  3. Great Information. I like the way you explain the article. Thank you for sharing this information. https://www.theplumbersgrapevinetx.com/

    ReplyDelete
  4. The post you have shared here about pipeline problems is really great as it contains some good knowledge which is very useful for me. Thanks for posting it. Keep it up. GAS DISTRIBUTION PIPE Calgary.

    ReplyDelete
  5. Gambling sites that accept Bitcoin | DrmCD
    This 통영 출장마사지 page explains 대전광역 출장안마 the steps you need to take to legally gamble at these licensed, regulated and regulated gambling sites, as well as ‎Withdrawal 사천 출장안마 Methods 문경 출장샵 · 영천 출장샵 ‎Deposit Methods

    ReplyDelete