mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #31534 from claudiob/kaspth-approach
Don't include Active Storage migrations in new apps
This commit is contained in:
commit
33721a71e3
7 changed files with 37 additions and 16 deletions
|
@ -25,6 +25,7 @@ module ActionDispatch
|
||||||
"ActionView::MissingTemplate" => "missing_template",
|
"ActionView::MissingTemplate" => "missing_template",
|
||||||
"ActionController::RoutingError" => "routing_error",
|
"ActionController::RoutingError" => "routing_error",
|
||||||
"AbstractController::ActionNotFound" => "unknown_action",
|
"AbstractController::ActionNotFound" => "unknown_action",
|
||||||
|
"ActiveRecord::StatementInvalid" => "invalid_statement",
|
||||||
"ActionView::Template::Error" => "template_error"
|
"ActionView::Template::Error" => "template_error"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<header>
|
||||||
|
<h1>
|
||||||
|
<%= @exception.class.to_s %>
|
||||||
|
<% if @request.parameters['controller'] %>
|
||||||
|
in <%= @request.parameters['controller'].camelize %>Controller<% if @request.parameters['action'] %>#<%= @request.parameters['action'] %><% end %>
|
||||||
|
<% end %>
|
||||||
|
</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div id="container">
|
||||||
|
<h2>
|
||||||
|
<%= h @exception.message %>
|
||||||
|
<% if @exception.message.match? %r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}} %>
|
||||||
|
<br />To resolve this issue run: bin/rails active_storage:install
|
||||||
|
<% end %>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<%= render template: "rescues/_source" %>
|
||||||
|
<%= render template: "rescues/_trace" %>
|
||||||
|
<%= render template: "rescues/_request_and_response" %>
|
||||||
|
</div>
|
|
@ -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" %>
|
|
@ -41,9 +41,6 @@ application to Rails 5.2, run `rails active_storage:install` to generate a
|
||||||
migration that creates these tables. Use `rails db:migrate` to run the
|
migration that creates these tables. Use `rails db:migrate` to run the
|
||||||
migration.
|
migration.
|
||||||
|
|
||||||
You need not run `rails active_storage:install` in a new Rails 5.2 application:
|
|
||||||
the migration is generated automatically.
|
|
||||||
|
|
||||||
Declare Active Storage services in `config/storage.yml`. For each service your
|
Declare Active Storage services in `config/storage.yml`. For each service your
|
||||||
application uses, provide a name and the requisite configuration. The example
|
application uses, provide a name and the requisite configuration. The example
|
||||||
below declares three services named `local`, `test`, and `amazon`:
|
below declares three services named `local`, `test`, and `amazon`:
|
||||||
|
|
|
@ -463,16 +463,6 @@ module Rails
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_active_storage
|
|
||||||
unless skip_active_storage?
|
|
||||||
if bundle_install?
|
|
||||||
rails_command "active_storage:install", capture: options[:quiet]
|
|
||||||
else
|
|
||||||
log("Active Storage installation was skipped. Please run `bin/rails active_storage:install` to install Active Storage files.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def empty_directory_with_keep_file(destination, config = {})
|
def empty_directory_with_keep_file(destination, config = {})
|
||||||
empty_directory(destination, config)
|
empty_directory(destination, config)
|
||||||
keep_file(destination)
|
keep_file(destination)
|
||||||
|
|
|
@ -463,7 +463,6 @@ module Rails
|
||||||
|
|
||||||
public_task :apply_rails_template, :run_bundle
|
public_task :apply_rails_template, :run_bundle
|
||||||
public_task :run_webpack, :generate_spring_binstubs
|
public_task :run_webpack, :generate_spring_binstubs
|
||||||
public_task :run_active_storage
|
|
||||||
|
|
||||||
def run_after_bundle_callbacks
|
def run_after_bundle_callbacks
|
||||||
@after_bundle_callbacks.each(&:call)
|
@after_bundle_callbacks.each(&:call)
|
||||||
|
|
|
@ -900,7 +900,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||||
template
|
template
|
||||||
end
|
end
|
||||||
|
|
||||||
sequence = ["git init", "install", "exec spring binstub --all", "active_storage:install", "echo ran after_bundle"]
|
sequence = ["git init", "install", "exec spring binstub --all", "echo ran after_bundle"]
|
||||||
@sequence_step ||= 0
|
@sequence_step ||= 0
|
||||||
ensure_bundler_first = -> command, options = nil do
|
ensure_bundler_first = -> command, options = nil do
|
||||||
assert_equal sequence[@sequence_step], command, "commands should be called in sequence #{sequence}"
|
assert_equal sequence[@sequence_step], command, "commands should be called in sequence #{sequence}"
|
||||||
|
@ -917,7 +917,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal 5, @sequence_step
|
assert_equal 4, @sequence_step
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_gitignore
|
def test_gitignore
|
||||||
|
|
Loading…
Reference in a new issue