javascript_include_tag Rails 4 generating “/javascripts/” instead of “/assets” in production

One of the usage statements for AssetUrlHelper indicates it will produce /javascripts/ urls
like what you are seeing:

# asset_path “application”, type: :javascript # => /javascripts/application.js

(from asset_url_helper.rb line 117 – [1])

This code looks like it can only be reached if the precompiled asset is missing
so it would appear that your asset compilation is not working (my deployments usually
fail when that happens, so maybe yours isn’t even firing).

The same asset_url_helper.rb calls the /javascripts/ part ‘extname’ and
uses the following map to know how to generate the name:

 # Maps asset types to public directory.
  ASSET_PUBLIC_DIRECTORIES = {
    audio:      '/audios',
    font:       '/fonts',
    image:      '/images',
    javascript: '/javascripts',
    stylesheet: '/stylesheets',
    video:      '/videos'
  }

A new Rails 4 app has this in the config/environments/production.rb

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = false

which seems to match the behavior you are seeing.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)