Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails does not load assets located in public directory in production

Tags:

Hello i have assets in public directory (because of simplicity)

in layout i load

<link href="/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="/assets/css/jumbotron.css" rel="stylesheet">
<link href="/assets/css/application.css" rel="stylesheet">

and in Development it works well but in Production assets are not loaded.

My Development.rb

Web::Application.configure do
  config.cache_classes = false
  config.whiny_nils = true
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false
  config.action_mailer.raise_delivery_errors = false
  config.active_support.deprecation = :log
  config.action_dispatch.best_standards_support = :builtin
  config.active_record.mass_assignment_sanitizer = :strict
  config.active_record.auto_explain_threshold_in_seconds = 0.5
  config.assets.compress = false
  config.assets.debug = true
end

My Production.rb

Web::Application.configure do
  config.cache_classes = false
  config.consider_all_requests_local       = true # default false, zobrazuje errory
  config.action_controller.perform_caching = false # default true
  config.serve_static_assets = false
  config.assets.compress = true
  config.assets.compile = true # default false
  config.assets.digest = true
  config.i18n.fallbacks = true
  config.active_support.deprecation = :notify
end
like image 987
Muflix Avatar asked Sep 14 '13 21:09

Muflix


1 Answers

Configuration changed for Rails 4 and 5.

For Rails 4:

config.serve_static_files = true

For Rails 5:

config.public_file_server.enabled = true
like image 117
sites Avatar answered Dec 05 '22 22:12

sites