aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
diff options
context:
space:
mode:
authorClaudio B <claudiob@users.noreply.github.com>2017-12-21 11:21:19 -0800
committerClaudio B <claudiob@users.noreply.github.com>2017-12-21 11:21:19 -0800
commite32eda6adfa929efb77aabebc6beeeb0d89a82bd (patch)
tree93014e31ea08ad2399a0a143b2d72077881dd4e8 /actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
parent74996cec93adf10e4e12e3f53479c4b3364dbb14 (diff)
downloadrails-e32eda6adfa929efb77aabebc6beeeb0d89a82bd.tar.gz
rails-e32eda6adfa929efb77aabebc6beeeb0d89a82bd.tar.bz2
rails-e32eda6adfa929efb77aabebc6beeeb0d89a82bd.zip
Help if Active Storage tables are missing
When a user tries to create a new attachment or blog and the matching table is missing from the database (`active_storage_attachments` and `active_storage_blobs` by default), an informative error is displayed that invites users to run the `active_storage:install` task.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb13
1 files changed, 13 insertions, 0 deletions
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
new file mode 100644
index 0000000000..033518cf8a
--- /dev/null
+++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb
@@ -0,0 +1,13 @@
+<%= @exception.class.to_s %><%
+ if @request.parameters['controller']
+%> in <%= @request.parameters['controller'].camelize %>Controller<% if @request.parameters['action'] %>#<%= @request.parameters['action'] %><% end %>
+<% end %>
+
+<%= @exception.message %>
+<% if @exception.message.match? %r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}} %>
+To resolve this issue run: bin/rails active_storage:install
+<% end %>
+
+<%= render template: "rescues/_source" %>
+<%= render template: "rescues/_trace" %>
+<%= render template: "rescues/_request_and_response" %>