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
Configuration changed for Rails 4 and 5.
For Rails 4:
config.serve_static_files = true
For Rails 5:
config.public_file_server.enabled = true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With