From 3cf65bcb8ee3c27204dee5cac003a749973240f9 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Fri, 12 Jul 2019 15:30:28 -0400 Subject: Make Active Storage routes optional Add configuration option to turn off drawing of Active Storage routes. --- activestorage/lib/active_storage.rb | 1 + activestorage/lib/active_storage/engine.rb | 1 + 2 files changed, 2 insertions(+) (limited to 'activestorage/lib') diff --git a/activestorage/lib/active_storage.rb b/activestorage/lib/active_storage.rb index 75eb63f0b4..c35a9920d6 100644 --- a/activestorage/lib/active_storage.rb +++ b/activestorage/lib/active_storage.rb @@ -60,6 +60,7 @@ module ActiveStorage mattr_accessor :service_urls_expire_in, default: 5.minutes mattr_accessor :routes_prefix, default: "/rails/active_storage" + mattr_accessor :draw_routes, default: true mattr_accessor :replace_on_assign_to_many, default: false diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index e88e7fa14e..9d9cd02d12 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -73,6 +73,7 @@ module ActiveStorage ActiveStorage.analyzers = app.config.active_storage.analyzers || [] ActiveStorage.paths = app.config.active_storage.paths || {} ActiveStorage.routes_prefix = app.config.active_storage.routes_prefix || "/rails/active_storage" + ActiveStorage.draw_routes = app.config.active_storage.draw_routes != false ActiveStorage.variable_content_types = app.config.active_storage.variable_content_types || [] ActiveStorage.content_types_to_serve_as_binary = app.config.active_storage.content_types_to_serve_as_binary || [] -- cgit v1.2.3