aboutsummaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorHans de Graaff <graaff@gentoo.org>2019-07-22 18:56:58 +0200
committerHans de Graaff <graaff@gentoo.org>2019-07-22 18:56:58 +0200
commita1b7c2071bfaaadcfb2b8cbca8c5aafabb12923a (patch)
tree9c198fc51149a7601cb1164dcd4ac03079010efc /config
parentAdd ETag and Last-Modified headers based on specific package (diff)
downloadpackages-5-a1b7c2071bfaaadcfb2b8cbca8c5aafabb12923a.tar.gz
packages-5-a1b7c2071bfaaadcfb2b8cbca8c5aafabb12923a.tar.bz2
packages-5-a1b7c2071bfaaadcfb2b8cbca8c5aafabb12923a.zip
Update to Rails 5.1
This also fixes a bug in the fresh_when handling for the changelog view, which was exposed by the update (due to ETag now taking the flash message, if any, into account). Signed-off-by: Hans de Graaff <graaff@gentoo.org>
Diffstat (limited to 'config')
-rw-r--r--config/application.rb5
-rw-r--r--config/environments/development.rb4
-rw-r--r--config/environments/test.rb2
-rw-r--r--config/initializers/assets.rb9
4 files changed, 14 insertions, 6 deletions
diff --git a/config/application.rb b/config/application.rb
index 9639248..136f5cc 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -17,6 +17,9 @@ Bundler.require(*Rails.groups)
module Packages
class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 5.1
+
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
@@ -37,6 +40,8 @@ module Packages
config.autoload_paths << Rails.root.join('lib')
config.active_job.queue_adapter = :sidekiq
+
+ config.middleware.use ActionDispatch::Flash
end
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index d241472..5670ba7 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -18,7 +18,7 @@ Rails.application.configure do
config.cache_store = :memory_store
config.public_file_server.headers = {
- 'Cache-Control' => 'public, max-age=172800'
+ 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
}
else
config.action_controller.perform_caching = false
@@ -50,5 +50,5 @@ Rails.application.configure do
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
- # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 1619c9b..4154d7e 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -15,7 +15,7 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
- 'Cache-Control' => 'public, max-age=3600'
+ 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
}
# Show full error reports and disable caching.
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 01ef3e6..4b828e8 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -3,9 +3,12 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
-# Add additional assets to the asset load path
+# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
+# Add Yarn node_modules folder to the asset load path.
+Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
-# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
-# Rails.application.config.assets.precompile += %w( search.js )
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )