mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix invalid statement template compile error
This commit is contained in:
parent
f7b65ee0c4
commit
1be3277a7b
2 changed files with 24 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
<%= @exception.message %>
|
<%= @exception.message %>
|
||||||
<% if defined?(ActiveStorage) && @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: bin/rails active_storage:install
|
To resolve this issue run: bin/rails active_storage:install
|
||||||
|
<% end %>
|
||||||
<% if defined?(ActionMailbox) && @exception.message.match?(%r{#{ActionMailbox::InboundEmail.table_name}}) %>
|
<% if defined?(ActionMailbox) && @exception.message.match?(%r{#{ActionMailbox::InboundEmail.table_name}}) %>
|
||||||
To resolve this issue run: bin/rails action_mailbox:install
|
To resolve this issue run: bin/rails action_mailbox:install
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -171,5 +171,28 @@ module ApplicationTests
|
||||||
assert_equal 400, last_response.status
|
assert_equal 400, last_response.status
|
||||||
assert_match "Invalid query parameters", last_response.body
|
assert_match "Invalid query parameters", last_response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "displays statement invalid template correctly" do
|
||||||
|
controller :foo, <<-RUBY
|
||||||
|
class FooController < ActionController::Base
|
||||||
|
def index
|
||||||
|
raise ActiveRecord::StatementInvalid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
RUBY
|
||||||
|
app.config.action_dispatch.show_exceptions = true
|
||||||
|
app.config.consider_all_requests_local = true
|
||||||
|
app.config.action_dispatch.ignore_accept_header = false
|
||||||
|
|
||||||
|
get "/foo"
|
||||||
|
assert_equal 500, last_response.status
|
||||||
|
assert_match "<title>Action Controller: Exception caught</title>", last_response.body
|
||||||
|
assert_match "ActiveRecord::StatementInvalid", last_response.body
|
||||||
|
|
||||||
|
get "/foo", {}, { "HTTP_ACCEPT" => "text/plain", "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest" }
|
||||||
|
assert_equal 500, last_response.status
|
||||||
|
assert_equal "text/plain", last_response.media_type
|
||||||
|
assert_match "ActiveRecord::StatementInvalid", last_response.body
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue