Question

After upgrading to Rails 4, public/assets/manifest.yml is not generated anymore. Instead the different formatted manifest-(fingerprint).json is present. But it seems to me that the server is still looking for the old manifest.yml format, ignoring the .json version?

I see other questions based on similar problems, but they seems to be sovled by upgrading to Rails 4, adding rails_12factor to gem file, setting serve_static_assets = true, etc., but none of these solutions seems to have any effect in my scenario.

I am tired and uninspired due to this annoying problem, any help will be appreciated!

Logfile from Heroku:

ActionController::RoutingError (No route matches [GET] "/assets/layouts/test/test.html"):

Gemfile:

ruby '2.0.0'
gem 'rails', '4.0.0'
...
gem "compass-rails", github: "milgner/compass-rails", ref: "1749c06f15dc4b058427e7969810457213647fb8"
...
gem 'rails_12factor', group: :production

production.rb

RailsFoundationAngular::Application.configure do
  config.assets.initialize_on_precompile = false
  config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.compress = true  
  config.assets.compile = false
  config.assets.digest = true
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
  config.action_dispatch.x_sendfile_header = nil
end

I am using Angular and their ui-router, and this is the part of my routes.js.coffee where the test.html is linked:

    .state "root",
      url: "/"
      views:
        "root":
          controller: "ApplicationController"
          templateUrl: "/assets/layouts/test/test.html"

I have also tried precompiling locally, but as I am using Rails 4 here as well, still no manifest.yml is created, only the .json version. Of course, everything is working just perfectly in development...

So my actual cuestion: How do I make Heroku recognize and use the manifest-(fingerprint).json -file, or alternative ways to make this work?

Was it helpful?

Solution

The answer is, that Heroku already does recognize and use the manifest-(fingerprint).json -file. The "workaround" in my comment above, is the proper way to reference these files, and by doing so, the manifest-file is used the way it's ment to be used.

Renaming the file with the internal link to .erb, and referencing like this: templateUrl: "<%= asset_path('layouts/test/test.html') %>" does the trick. All internal files, images, and html -files should be referenced like this.

It's all described very thoroughly here: Asset-pipeline guide

It seems so simple and straightforward now, but I really spent a lot of time trying to get the wrong way around this from the beginning. I hope this answer can save the time for someone else.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top