aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2019-02-05 08:36:31 -0500
committerGitHub <noreply@github.com>2019-02-05 08:36:31 -0500
commit44232b485485634d681c60868c619323f882e59f (patch)
tree70e70a653b00cb3286623dc6fdf53e1af703be9d
parenteec3e28a1abf75676dcee58308ee5721bb53c325 (diff)
parenta0c57775e2ee91d3bd860699c3a3fcb110d0bb08 (diff)
downloadrails-44232b485485634d681c60868c619323f882e59f.tar.gz
rails-44232b485485634d681c60868c619323f882e59f.tar.bz2
rails-44232b485485634d681c60868c619323f882e59f.zip
Merge pull request #35139 from 7coAim/fix_debug_exceptions
Fix NameError : Make debug exceptions works in an environment where ActiveStorage is not loaded.
-rw-r--r--actionpack/CHANGELOG.md4
-rw-r--r--actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb2
-rw-r--r--actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb2
3 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 6348bef4cb..23ac619f50 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Make debug exceptions works in an environment where ActiveStorage is not loaded.
+
+ *Tomoyuki Kurosawa*
+
* `ActionDispatch::SystemTestCase.driven_by` can now be called with a block
to define specific browser capabilities.
diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb
index e8454acfad..d144fc1cd2 100644
--- a/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb
+++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb
@@ -10,7 +10,7 @@
<div id="container">
<h2>
<%= h @exception.message %>
- <% if @exception.message.match? %r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}} %>
+ <% if defined?(ActiveStorage) && @exception.message.match?(%r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}) %>
<br />To resolve this issue run: rails active_storage:install
<% end %>
</h2>
diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
index e5e3196710..55aaf58713 100644
--- a/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
+++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
@@ -4,7 +4,7 @@
<% end %>
<%= @exception.message %>
-<% if @exception.message.match? %r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}} %>
+<% if defined?(ActiveStorage) && @exception.message.match?(%r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}) %>
To resolve this issue run: rails active_storage:install
<% end %>