railties 5.2.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +293 -89
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +39 -33
- data/README.rdoc +3 -3
- data/lib/minitest/rails_plugin.rb +24 -13
- data/lib/rails/all.rb +4 -0
- data/lib/rails/api/generator.rb +2 -1
- data/lib/rails/api/task.rb +17 -0
- data/lib/rails/app_loader.rb +2 -2
- data/lib/rails/app_updater.rb +4 -1
- data/lib/rails/application/bootstrap.rb +9 -17
- data/lib/rails/application/configuration.rb +177 -27
- data/lib/rails/application/default_middleware_stack.rb +7 -3
- data/lib/rails/application/dummy_erb_compiler.rb +18 -0
- data/lib/rails/application/finisher.rb +69 -2
- data/lib/rails/application/routes_reloader.rb +9 -19
- data/lib/rails/application.rb +96 -66
- data/lib/rails/application_controller.rb +0 -1
- data/lib/rails/autoloaders.rb +48 -0
- data/lib/rails/backtrace_cleaner.rb +14 -21
- data/lib/rails/code_statistics.rb +8 -6
- data/lib/rails/code_statistics_calculator.rb +6 -6
- data/lib/rails/command/actions.rb +10 -0
- data/lib/rails/command/base.rb +17 -5
- data/lib/rails/command/behavior.rb +8 -49
- data/lib/rails/command/environment_argument.rb +9 -16
- data/lib/rails/command/spellchecker.rb +57 -0
- data/lib/rails/command.rb +18 -11
- data/lib/rails/commands/console/console_command.rb +6 -0
- data/lib/rails/commands/credentials/USAGE +33 -0
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
- data/lib/rails/commands/credentials/credentials_command.rb +78 -21
- data/lib/rails/commands/db/system/change/change_command.rb +25 -0
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +66 -51
- data/lib/rails/commands/dev/dev_command.rb +19 -0
- data/lib/rails/commands/encrypted/USAGE +28 -0
- data/lib/rails/commands/encrypted/encrypted_command.rb +5 -4
- data/lib/rails/commands/generate/generate_command.rb +1 -1
- data/lib/rails/commands/help/help_command.rb +1 -1
- data/lib/rails/commands/initializers/initializers_command.rb +23 -0
- data/lib/rails/commands/new/new_command.rb +2 -2
- data/lib/rails/commands/notes/notes_command.rb +29 -0
- data/lib/rails/commands/plugin/plugin_command.rb +1 -1
- data/lib/rails/commands/rake/rake_command.rb +9 -8
- data/lib/rails/commands/routes/routes_command.rb +37 -0
- data/lib/rails/commands/runner/runner_command.rb +13 -9
- data/lib/rails/commands/secrets/USAGE +6 -0
- data/lib/rails/commands/secrets/secrets_command.rb +3 -3
- data/lib/rails/commands/server/server_command.rb +92 -56
- data/lib/rails/commands/test/test_command.rb +2 -2
- data/lib/rails/configuration.rb +48 -19
- data/lib/rails/engine/configuration.rb +6 -2
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/engine.rb +63 -35
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions/create_migration.rb +5 -1
- data/lib/rails/generators/actions.rb +89 -56
- data/lib/rails/generators/app_base.rb +80 -108
- data/lib/rails/generators/app_name.rb +50 -0
- data/lib/rails/generators/base.rb +19 -12
- data/lib/rails/generators/database.rb +57 -0
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +1 -2
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +0 -1
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +7 -4
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +9 -1
- data/lib/rails/generators/erb.rb +0 -1
- data/lib/rails/generators/generated_attribute.rb +50 -31
- data/lib/rails/generators/migration.rb +3 -3
- data/lib/rails/generators/model_helpers.rb +33 -2
- data/lib/rails/generators/named_base.rb +3 -7
- data/lib/rails/generators/rails/app/USAGE +2 -1
- data/lib/rails/generators/rails/app/app_generator.rb +127 -84
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +18 -21
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -3
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +6 -0
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +5 -0
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +23 -0
- data/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt +5 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +6 -5
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -9
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +9 -0
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +11 -3
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +16 -7
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/cable.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +4 -5
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +13 -12
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +13 -12
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +16 -15
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +22 -5
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +43 -17
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +26 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +7 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +63 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +13 -4
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +6 -6
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +10 -7
- data/lib/rails/generators/rails/app/templates/package.json.tt +8 -2
- data/lib/rails/generators/rails/app/templates/public/robots.txt +1 -1
- data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +9 -2
- data/lib/rails/generators/rails/assets/USAGE +3 -7
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -1
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +2 -2
- data/lib/rails/generators/rails/controller/controller_generator.rb +10 -39
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +6 -7
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +65 -0
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +10 -7
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -0
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
- data/lib/rails/generators/rails/helper/USAGE +2 -3
- data/lib/rails/generators/rails/helper/helper_generator.rb +5 -0
- data/lib/rails/generators/rails/integration_test/USAGE +2 -2
- data/lib/rails/generators/rails/migration/USAGE +4 -4
- data/lib/rails/generators/rails/model/USAGE +15 -16
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +32 -56
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +18 -18
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +1 -2
- data/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +14 -11
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/railtie.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -4
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
- data/lib/rails/generators/rails/scaffold/USAGE +5 -5
- data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +19 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +2 -2
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/resource_helpers.rb +1 -6
- data/lib/rails/generators/test_case.rb +1 -1
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +5 -0
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/job/job_generator.rb +5 -0
- data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +1 -1
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +12 -3
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +10 -2
- data/lib/rails/generators/test_unit/system/system_generator.rb +5 -0
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/behaviour.rb +4 -2
- data/lib/rails/generators.rb +38 -24
- data/lib/rails/info.rb +4 -4
- data/lib/rails/info_controller.rb +2 -3
- data/lib/rails/mailers_controller.rb +10 -4
- data/lib/rails/paths.rb +26 -10
- data/lib/rails/rack/logger.rb +5 -6
- data/lib/rails/railtie/configurable.rb +0 -1
- data/lib/rails/railtie/configuration.rb +3 -3
- data/lib/rails/railtie.rb +33 -13
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/secrets.rb +0 -1
- data/lib/rails/source_annotation_extractor.rb +124 -117
- data/lib/rails/tasks/engine.rake +1 -4
- data/lib/rails/tasks/framework.rake +13 -3
- data/lib/rails/tasks/log.rake +0 -1
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/statistics.rake +5 -1
- data/lib/rails/tasks/yarn.rake +14 -1
- data/lib/rails/tasks/zeitwerk.rake +69 -0
- data/lib/rails/tasks.rb +1 -4
- data/lib/rails/templates/rails/mailers/email.html.erb +11 -7
- data/lib/rails/templates/rails/welcome/index.html.erb +3 -3
- data/lib/rails/test_help.rb +11 -9
- data/lib/rails/test_unit/reporter.rb +3 -2
- data/lib/rails/test_unit/runner.rb +25 -8
- data/lib/rails/test_unit/testing.rake +7 -1
- data/lib/rails.rb +10 -8
- metadata +45 -39
- data/lib/rails/generators/js/assets/assets_generator.rb +0 -15
- data/lib/rails/generators/js/assets/templates/javascript.js +0 -2
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +0 -22
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js.tt +0 -13
- data/lib/rails/generators/rails/app/templates/bin/bundle.tt +0 -2
- data/lib/rails/generators/rails/app/templates/bin/update.tt +0 -34
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +0 -35
- data/lib/rails/generators/rails/assets/templates/javascript.js +0 -2
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- data/lib/rails/tasks/annotations.rake +0 -22
- data/lib/rails/tasks/dev.rake +0 -10
- data/lib/rails/tasks/initializers.rake +0 -8
- data/lib/rails/tasks/routes.rake +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1adfe379d94049a35a1306f22a5d1368e3b88455d57bb1e4764b845f7ec7e0c5
|
4
|
+
data.tar.gz: 1ff026a5d1cc46e2cb543b15568fb2f12915d468a3c3723efd2daa18d70fc04a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b297610d901f515027eb7bb31b3bf912437ccc0643276ba5b166216fe41f8f6e74b42783002d8bd1a904fa512b18ffbcb258375d019299918a21c5b6c220cf6
|
7
|
+
data.tar.gz: 9b1c0e55db347c811b93edb2e68dee00b99cd476e917de5e138c09faa4eaaaa1df3a374bc54b09934895c22993080e327d530129ba4163f209cd42d438deaabe
|
data/CHANGELOG.md
CHANGED
@@ -1,167 +1,371 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.1.0 (December 09, 2020) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Added `Railtie#server` hook called when Rails starts a server.
|
4
|
+
This is useful in case your application or a library needs to run
|
5
|
+
another process next to the Rails server. This is quite common in development
|
6
|
+
for instance to run the Webpack or the React server.
|
4
7
|
|
5
|
-
|
8
|
+
It can be used like this:
|
6
9
|
|
7
|
-
|
10
|
+
```ruby
|
11
|
+
class MyRailtie < Rails::Railtie
|
12
|
+
server do
|
13
|
+
WebpackServer.run
|
14
|
+
end
|
15
|
+
end
|
16
|
+
```
|
8
17
|
|
9
|
-
*
|
18
|
+
*Edouard Chin*
|
10
19
|
|
11
|
-
*
|
20
|
+
* Remove deprecated `rake dev:cache` tasks.
|
12
21
|
|
13
|
-
*
|
22
|
+
*Rafael Mendonça França*
|
14
23
|
|
15
|
-
*
|
16
|
-
Add ability to skip `Active Storage` with `--skip-active-storage`
|
17
|
-
and do so automatically when `--skip-active-record` is used.
|
24
|
+
* Remove deprecated `rake routes` tasks.
|
18
25
|
|
19
|
-
*
|
26
|
+
*Rafael Mendonça França*
|
20
27
|
|
21
|
-
*
|
28
|
+
* Remove deprecated `rake initializers` tasks.
|
22
29
|
|
23
|
-
*
|
30
|
+
*Rafael Mendonça França*
|
24
31
|
|
25
|
-
*
|
32
|
+
* Remove deprecated support for using the `HOST` environment variable to specify the server IP.
|
26
33
|
|
27
|
-
*
|
34
|
+
*Rafael Mendonça França*
|
28
35
|
|
29
|
-
*
|
36
|
+
* Remove deprecated `server` argument from the rails server command.
|
30
37
|
|
31
|
-
|
38
|
+
*Rafael Mendonça França*
|
32
39
|
|
33
|
-
|
40
|
+
* Remove deprecated `SOURCE_ANNOTATION_DIRECTORIES` environment variable support from `rails notes`.
|
34
41
|
|
35
|
-
*
|
42
|
+
*Rafael Mendonça França*
|
36
43
|
|
37
|
-
|
44
|
+
* Remove deprecated `connection` option in the `rails dbconsole` command.
|
38
45
|
|
39
|
-
*
|
46
|
+
*Rafael Mendonça França*
|
40
47
|
|
41
|
-
|
48
|
+
* Remove depreated `rake notes` tasks.
|
42
49
|
|
43
|
-
*
|
50
|
+
*Rafael Mendonça França*
|
44
51
|
|
45
|
-
|
52
|
+
* Return a 405 Method Not Allowed response when a request uses an unknown HTTP method.
|
46
53
|
|
47
|
-
|
54
|
+
Fixes #38998.
|
48
55
|
|
49
|
-
*
|
56
|
+
*Loren Norman*
|
50
57
|
|
51
|
-
*
|
58
|
+
* Make railsrc file location xdg-specification compliant
|
52
59
|
|
53
|
-
|
60
|
+
`rails new` will now look for the default `railsrc` file at
|
61
|
+
`$XDG_CONFIG_HOME/rails/railsrc` (or `~/.config/rails/railsrc` if
|
62
|
+
`XDG_CONFIG_HOME` is not set). If this file does not exist, `rails new`
|
63
|
+
will fall back to `~/.railsrc`.
|
54
64
|
|
55
|
-
|
65
|
+
The fallback behaviour means this does not cause any breaking changes.
|
56
66
|
|
57
|
-
*
|
67
|
+
*Nick Wolf*
|
58
68
|
|
59
|
-
*
|
69
|
+
* Change the default logging level from :debug to :info to avoid inadvertent exposure of personally
|
70
|
+
identifiable information (PII) in production environments.
|
60
71
|
|
61
|
-
*
|
72
|
+
*Eric M. Payne*
|
62
73
|
|
63
|
-
*
|
74
|
+
* Automatically generate abstract class when using multiple databases.
|
64
75
|
|
65
|
-
|
76
|
+
When generating a scaffold for a multiple database application, Rails will now automatically generate the abstract class for the database when the database argument is passed. This abstract class will include the connection information for the writing configuration and any models generated for that database will automatically inherit from the abstract class.
|
66
77
|
|
67
|
-
|
68
|
-
root file containing the current Ruby version when new Rails applications are
|
69
|
-
created.
|
78
|
+
Usage:
|
70
79
|
|
71
|
-
|
80
|
+
```bash
|
81
|
+
$ bin/rails generate scaffold Pet name:string --database=animals
|
82
|
+
```
|
72
83
|
|
73
|
-
|
74
|
-
`rails runner`
|
84
|
+
Will create an abstract class for the animals connection.
|
75
85
|
|
76
|
-
|
86
|
+
```ruby
|
87
|
+
class AnimalsRecord < ApplicationRecord
|
88
|
+
self.abstract_class = true
|
77
89
|
|
78
|
-
|
90
|
+
connects_to database: { writing: :animals }
|
91
|
+
end
|
92
|
+
```
|
79
93
|
|
80
|
-
|
94
|
+
And generate a `Pet` model that inherits from the new `AnimalsRecord`:
|
81
95
|
|
82
|
-
|
83
|
-
|
96
|
+
```ruby
|
97
|
+
class Pet < AnimalsRecord
|
98
|
+
end
|
99
|
+
```
|
84
100
|
|
85
|
-
|
101
|
+
If you already have an abstract class and it follows a different pattern than Rails defaults, you can pass a parent class with the database argument.
|
86
102
|
|
87
|
-
|
88
|
-
|
89
|
-
|
103
|
+
```bash
|
104
|
+
$ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
|
105
|
+
```
|
90
106
|
|
91
|
-
|
107
|
+
This will ensure the model inherits from the `SecondaryBase` parent instead of `AnimalsRecord`
|
92
108
|
|
93
|
-
|
109
|
+
```ruby
|
110
|
+
class Pet < SecondaryBase
|
111
|
+
end
|
112
|
+
```
|
94
113
|
|
95
|
-
|
114
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
96
115
|
|
97
|
-
|
116
|
+
* Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
|
98
117
|
|
99
|
-
*
|
118
|
+
*Chris Oliver*
|
100
119
|
|
101
|
-
*
|
102
|
-
command when using a 3-level database configuration.
|
120
|
+
* Create a new rails app using a minimal stack.
|
103
121
|
|
104
|
-
|
122
|
+
`rails new cool_app --minimal`
|
105
123
|
|
106
|
-
|
124
|
+
All the following are excluded from your minimal stack:
|
107
125
|
|
108
|
-
|
126
|
+
- action_cable
|
127
|
+
- action_mailbox
|
128
|
+
- action_mailer
|
129
|
+
- action_text
|
130
|
+
- active_job
|
131
|
+
- active_storage
|
132
|
+
- bootsnap
|
133
|
+
- jbuilder
|
134
|
+
- spring
|
135
|
+
- system_tests
|
136
|
+
- turbolinks
|
137
|
+
- webpack
|
109
138
|
|
110
|
-
|
111
|
-
the update task honors those skips too.
|
139
|
+
*Haroon Ahmed*, *DHH*
|
112
140
|
|
113
|
-
|
141
|
+
* Add default ENV variable option with BACKTRACE to turn off backtrace cleaning when debugging framework code in the
|
142
|
+
generated config/initializers/backtrace_silencers.rb.
|
114
143
|
|
115
|
-
|
144
|
+
`BACKTRACE=1 ./bin/rails runner "MyClass.perform"`
|
116
145
|
|
117
|
-
|
118
|
-
and thereby not eager loading it — we can co-exist much better with
|
119
|
-
other minitest plugins such as pride and minitest-focus.
|
146
|
+
*DHH*
|
120
147
|
|
121
|
-
|
148
|
+
* The autoloading guide for Zeitwerk mode documents how to autoload classes
|
149
|
+
during application boot in a safe way.
|
122
150
|
|
123
|
-
*
|
151
|
+
*Haroon Ahmed*, *Xavier Noria*
|
124
152
|
|
125
|
-
|
153
|
+
* The `classic` autoloader starts its deprecation cycle.
|
126
154
|
|
127
|
-
|
155
|
+
New Rails projects are strongly discouraged from using `classic`, and we recommend that existing projects running on `classic` switch to `zeitwerk` mode when upgrading. Please check the [_Upgrading Ruby on Rails_](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html) guide for tips.
|
128
156
|
|
129
|
-
*
|
157
|
+
*Xavier Noria*
|
130
158
|
|
131
|
-
|
159
|
+
* Adds `rails test:all` for running all tests in the test directory.
|
132
160
|
|
133
|
-
|
161
|
+
This runs all test files in the test directory, including system tests.
|
134
162
|
|
135
|
-
|
163
|
+
*Niklas Häusele*
|
136
164
|
|
137
|
-
|
165
|
+
* Add `config.generators.after_generate` for processing to generated files.
|
138
166
|
|
139
|
-
|
167
|
+
Register a callback that will get called right after generators has finished.
|
140
168
|
|
141
169
|
*Yuji Yaginuma*
|
142
170
|
|
143
|
-
*
|
171
|
+
* Make test file patterns configurable via Environment variables
|
144
172
|
|
145
|
-
|
173
|
+
This makes test file patterns configurable via two environment variables:
|
174
|
+
`DEFAULT_TEST`, to configure files to test, and `DEFAULT_TEST_EXCLUDE`,
|
175
|
+
to configure files to exclude from testing.
|
146
176
|
|
147
|
-
|
177
|
+
These values were hardcoded before, which made it difficult to add
|
178
|
+
new categories of tests that should not be executed by default (e.g:
|
179
|
+
smoke tests).
|
148
180
|
|
149
|
-
*
|
181
|
+
*Jorge Manrubia*
|
150
182
|
|
151
|
-
*
|
183
|
+
* No longer include `rake rdoc` task when generating plugins.
|
152
184
|
|
153
|
-
|
185
|
+
To generate docs, use the `rdoc lib` command instead.
|
154
186
|
|
155
|
-
*
|
187
|
+
*Jonathan Hefner*
|
188
|
+
|
189
|
+
* Allow relative paths with trailing slashes to be passed to `rails test`.
|
190
|
+
|
191
|
+
*Eugene Kenny*
|
192
|
+
|
193
|
+
* Add `rack-mini-profiler` gem to the default `Gemfile`.
|
194
|
+
|
195
|
+
`rack-mini-profiler` displays performance information such as SQL time and flame graphs.
|
196
|
+
It's enabled by default in development environment, but can be enabled in production as well.
|
197
|
+
See the gem [README](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md) for information on how to enable it in production.
|
198
|
+
|
199
|
+
*Osama Sayegh*
|
200
|
+
|
201
|
+
* `rails stats` will now count TypeScript files toward JavaScript stats.
|
202
|
+
|
203
|
+
*Joshua Cody*
|
204
|
+
|
205
|
+
* Run `git init` when generating plugins.
|
206
|
+
|
207
|
+
Opt out with `--skip-git`.
|
208
|
+
|
209
|
+
*OKURA Masafumi*
|
210
|
+
|
211
|
+
* Add benchmark generator.
|
212
|
+
|
213
|
+
Introduce benchmark generator to benchmark Rails applications.
|
214
|
+
|
215
|
+
`rails generate benchmark opt_compare`
|
216
|
+
|
217
|
+
This creates a benchmark file that uses [`benchmark-ips`](https://github.com/evanphx/benchmark-ips).
|
218
|
+
By default, two code blocks can be benchmarked using the `before` and `after` reports.
|
219
|
+
|
220
|
+
You can run the generated benchmark file using:
|
221
|
+
`ruby script/benchmarks/opt_compare.rb`
|
222
|
+
|
223
|
+
*Kevin Jalbert*, *Gannon McGibbon*
|
224
|
+
|
225
|
+
* Cache compiled view templates when running tests by default.
|
226
|
+
|
227
|
+
When generating a new app without `--skip-spring`, caching classes is
|
228
|
+
disabled in `environments/test.rb`. This implicitly disables caching
|
229
|
+
view templates too. This change will enable view template caching by
|
230
|
+
adding this to the generated `environments/test.rb`:
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
config.action_view.cache_template_loading = true
|
234
|
+
```
|
235
|
+
|
236
|
+
*Jorge Manrubia*
|
237
|
+
|
238
|
+
* Introduce middleware move operations.
|
239
|
+
|
240
|
+
With this change, you no longer need to delete and reinsert a middleware to
|
241
|
+
move it from one place to another in the stack:
|
242
|
+
|
243
|
+
```ruby
|
244
|
+
config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
|
245
|
+
```
|
246
|
+
|
247
|
+
This will move the `Magical::Unicorns` middleware before
|
248
|
+
`ActionDispatch::Flash`. You can also move it after with:
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
|
252
|
+
```
|
253
|
+
|
254
|
+
*Genadi Samokovarov*
|
255
|
+
|
256
|
+
* Generators that inherit from NamedBase respect `--force` option.
|
257
|
+
|
258
|
+
*Josh Brody*
|
259
|
+
|
260
|
+
* Allow configuration of eager_load behaviour for rake environment:
|
261
|
+
|
262
|
+
config.rake_eager_load
|
263
|
+
|
264
|
+
Defaults to `false` as per previous behaviour.
|
265
|
+
|
266
|
+
*Thierry Joyal*
|
267
|
+
|
268
|
+
* Ensure Rails migration generator respects system-wide primary key config.
|
269
|
+
|
270
|
+
When rails is configured to use a specific primary key type:
|
271
|
+
|
272
|
+
```ruby
|
273
|
+
config.generators do |g|
|
274
|
+
g.orm :active_record, primary_key_type: :uuid
|
275
|
+
end
|
276
|
+
```
|
277
|
+
|
278
|
+
Previously:
|
279
|
+
|
280
|
+
```bash
|
281
|
+
$ bin/rails g migration add_location_to_users location:references
|
282
|
+
```
|
283
|
+
|
284
|
+
The references line in the migration would not have `type: :uuid`.
|
285
|
+
This change causes the type to be applied appropriately.
|
286
|
+
|
287
|
+
*Louis-Michel Couture*, *Dermot Haughey*
|
288
|
+
|
289
|
+
* Deprecate `Rails::DBConsole#config`.
|
290
|
+
|
291
|
+
`Rails::DBConsole#config` is deprecated without replacement. Use `Rails::DBConsole.db_config.configuration_hash` instead.
|
292
|
+
|
293
|
+
*Eileen M. Uchitelle*, *John Crepezzi*
|
294
|
+
|
295
|
+
* `Rails.application.config_for` merges shared configuration deeply.
|
296
|
+
|
297
|
+
```yaml
|
298
|
+
# config/example.yml
|
299
|
+
shared:
|
300
|
+
foo:
|
301
|
+
bar:
|
302
|
+
baz: 1
|
303
|
+
development:
|
304
|
+
foo:
|
305
|
+
bar:
|
306
|
+
qux: 2
|
307
|
+
```
|
308
|
+
|
309
|
+
```ruby
|
310
|
+
# Previously
|
311
|
+
Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 }
|
312
|
+
|
313
|
+
# Now
|
314
|
+
Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
|
315
|
+
```
|
316
|
+
|
317
|
+
*Yuhei Kiriyama*
|
318
|
+
|
319
|
+
* Remove access to values in nested hashes returned by `Rails.application.config_for` via String keys.
|
320
|
+
|
321
|
+
```yaml
|
322
|
+
# config/example.yml
|
323
|
+
development:
|
324
|
+
options:
|
325
|
+
key: value
|
326
|
+
```
|
327
|
+
|
328
|
+
```ruby
|
329
|
+
Rails.application.config_for(:example).options
|
330
|
+
```
|
331
|
+
|
332
|
+
This used to return a Hash on which you could access values with String keys. This was deprecated in 6.0, and now doesn't work anymore.
|
333
|
+
|
334
|
+
*Étienne Barrié*
|
335
|
+
|
336
|
+
* Configuration files for environments (`config/environments/*.rb`) are
|
337
|
+
now able to modify `autoload_paths`, `autoload_once_paths`, and
|
338
|
+
`eager_load_paths`.
|
339
|
+
|
340
|
+
As a consequence, applications cannot autoload within those files. Before, they technically could, but changes in autoloaded classes or modules had no effect anyway in the configuration because reloading does not reboot.
|
341
|
+
|
342
|
+
Ways to use application code in these files:
|
343
|
+
|
344
|
+
* Define early in the boot process a class that is not reloadable, from which the application takes configuration values that get passed to the framework.
|
345
|
+
|
346
|
+
```ruby
|
347
|
+
# In config/application.rb, for example.
|
348
|
+
require "#{Rails.root}/lib/my_app/config"
|
349
|
+
|
350
|
+
# In config/environments/development.rb, for example.
|
351
|
+
config.foo = MyApp::Config.foo
|
352
|
+
```
|
353
|
+
|
354
|
+
* If the class has to be reloadable, then wrap the configuration code in a `to_prepare` block:
|
355
|
+
|
356
|
+
```ruby
|
357
|
+
config.to_prepare do
|
358
|
+
config.foo = MyModel.foo
|
359
|
+
end
|
360
|
+
```
|
156
361
|
|
157
|
-
|
362
|
+
That assigns the latest `MyModel.foo` to `config.foo` when the application boots, and each time there is a reload. But whether that has an effect or not depends on the configuration point, since it is not uncommon for engines to read the application configuration during initialization and set their own state from them. That process happens only on boot, not on reloads, and if that is how `config.foo` worked, resetting it would have no effect in the state of the engine.
|
158
363
|
|
159
|
-
*
|
364
|
+
*Allen Hsu* & *Xavier Noria*
|
160
365
|
|
161
|
-
*
|
162
|
-
when using Turbolinks.
|
366
|
+
* Support using environment variable to set pidfile.
|
163
367
|
|
164
|
-
*
|
368
|
+
*Ben Thorner*
|
165
369
|
|
166
370
|
|
167
|
-
Please check [
|
371
|
+
Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/railties/CHANGELOG.md) for previous changes.
|
data/MIT-LICENSE
CHANGED
data/RDOC_MAIN.rdoc
CHANGED
@@ -1,48 +1,55 @@
|
|
1
|
-
|
1
|
+
= Welcome to \Rails
|
2
|
+
|
3
|
+
== What's \Rails
|
2
4
|
|
3
5
|
\Rails is a web-application framework that includes everything needed to
|
4
6
|
create database-backed web applications according to the
|
5
|
-
{Model-View-Controller (MVC)}[
|
7
|
+
{Model-View-Controller (MVC)}[https://en.wikipedia.org/wiki/Model-view-controller]
|
6
8
|
pattern.
|
7
9
|
|
8
10
|
Understanding the MVC pattern is key to understanding \Rails. MVC divides your
|
9
|
-
application into three layers, each with a specific responsibility.
|
11
|
+
application into three layers: Model, View, and Controller, each with a specific responsibility.
|
12
|
+
|
13
|
+
== Model layer
|
10
14
|
|
11
|
-
The <em>Model layer</em> represents
|
12
|
-
Person, Post, etc.) and encapsulates the business logic
|
15
|
+
The <em><b>Model layer</b></em> represents the domain model (such as Account, Product,
|
16
|
+
Person, Post, etc.) and encapsulates the business logic specific to
|
13
17
|
your application. In \Rails, database-backed model classes are derived from
|
14
|
-
ActiveRecord::Base
|
18
|
+
<tt>ActiveRecord::Base</tt>. {Active Record}[link:files/activerecord/README_rdoc.html] allows you to present the data from
|
15
19
|
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods.
|
17
|
-
Although most \Rails models are backed by a database, models can also be ordinary
|
20
|
+
methods. Although most \Rails models are backed by a database, models can also be ordinary
|
18
21
|
Ruby classes, or Ruby classes that implement a set of interfaces as provided by
|
19
|
-
the Active Model
|
22
|
+
the {Active Model}[link:files/activemodel/README_rdoc.html] module.
|
20
23
|
|
21
|
-
|
24
|
+
== Controller layer
|
25
|
+
|
26
|
+
The <em><b>Controller layer</b></em> is responsible for handling incoming HTTP requests and
|
22
27
|
providing a suitable response. Usually this means returning \HTML, but \Rails controllers
|
23
28
|
can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and
|
24
29
|
manipulate models, and render view templates in order to generate the appropriate HTTP response.
|
25
30
|
In \Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and
|
26
|
-
controller classes are derived from ActionController::Base
|
27
|
-
are bundled together in Action Pack.
|
28
|
-
|
31
|
+
controller classes are derived from <tt>ActionController::Base</tt>. Action Dispatch and Action Controller
|
32
|
+
are bundled together in {Action Pack}[link:files/actionpack/README_rdoc.html].
|
33
|
+
|
34
|
+
== View layer
|
29
35
|
|
30
|
-
The <em>View layer</em> is composed of "templates" that are responsible for providing
|
36
|
+
The <em><b>View layer</b></em> is composed of "templates" that are responsible for providing
|
31
37
|
appropriate representations of your application's resources. Templates can
|
32
38
|
come in a variety of formats, but most view templates are \HTML with embedded
|
33
39
|
Ruby code (ERB files). Views are typically rendered to generate a controller response,
|
34
|
-
or to generate the body of an email. In \Rails, View generation is handled by Action View.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
and
|
40
|
+
or to generate the body of an email. In \Rails, View generation is handled by {Action View}[link:files/actionview/README_rdoc.html].
|
41
|
+
|
42
|
+
== Frameworks and libraries
|
43
|
+
|
44
|
+
{Active Record}[link:files/activerecord/README_rdoc.html], {Active Model}[link:files/activemodel/README_rdoc.html],
|
45
|
+
{Action Pack}[link:files/actionpack/README_rdoc.html], and {Action View}[link:files/actionview/README_rdoc.html] can each be used independently outside \Rails.
|
46
|
+
In addition to that, \Rails also comes with {Action Mailer}[link:files/actionmailer/README_rdoc.html], a library
|
47
|
+
to generate and send emails; {Action Mailbox}[link:files/actionmailbox/README_md.html], a library to receive emails within a Rails application;
|
48
|
+
{Active Job}[link:files/activejob/README_md.html], a framework for declaring jobs and making them run on a variety of queueing
|
49
|
+
backends; {Action Cable}[link:files/actioncable/README_md.html], a framework to
|
50
|
+
integrate WebSockets with a \Rails application; {Active Storage}[link:files/activestorage/README_md.html],
|
51
|
+
a library to attach cloud and local files to \Rails applications; {Action Text}[link:files/actiontext/README_md.html], a library to handle rich text content;
|
52
|
+
and {Active Support}[link:files/activesupport/README_rdoc.html], a collection
|
46
53
|
of utility classes and standard library extensions that are useful for \Rails,
|
47
54
|
and may also be used independently outside \Rails.
|
48
55
|
|
@@ -61,7 +68,7 @@ and may also be used independently outside \Rails.
|
|
61
68
|
3. Change directory to +myapp+ and start the web server:
|
62
69
|
|
63
70
|
$ cd myapp
|
64
|
-
$ rails server
|
71
|
+
$ bin/rails server
|
65
72
|
|
66
73
|
Run with <tt>--help</tt> or <tt>-h</tt> for options.
|
67
74
|
|
@@ -70,18 +77,17 @@ and may also be used independently outside \Rails.
|
|
70
77
|
5. Follow the guidelines to start developing your application. You may find the following resources handy:
|
71
78
|
|
72
79
|
* The \README file created within your application.
|
73
|
-
* {Getting Started with \Rails}[
|
74
|
-
* {Ruby on \Rails Guides}[
|
75
|
-
* {The API Documentation}[
|
76
|
-
* {Ruby on \Rails Tutorial}[https://www.railstutorial.org/book].
|
80
|
+
* {Getting Started with \Rails}[https://guides.rubyonrails.org/getting_started.html].
|
81
|
+
* {Ruby on \Rails Guides}[https://guides.rubyonrails.org].
|
82
|
+
* {The API Documentation}[https://api.rubyonrails.org].
|
77
83
|
|
78
84
|
== Contributing
|
79
85
|
|
80
86
|
We encourage you to contribute to Ruby on \Rails! Please check out the
|
81
|
-
{Contributing to Ruby on \Rails guide}[
|
87
|
+
{Contributing to Ruby on \Rails guide}[https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how to proceed. {Join us!}[http://contributors.rubyonrails.org]
|
82
88
|
|
83
89
|
Trying to report a possible security vulnerability in \Rails? Please
|
84
|
-
check out our {security policy}[
|
90
|
+
check out our {security policy}[https://rubyonrails.org/security/] for
|
85
91
|
guidelines about how to proceed.
|
86
92
|
|
87
93
|
Everyone interacting in \Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the \Rails {code of conduct}[http://rubyonrails.org/conduct/].
|
data/README.rdoc
CHANGED
@@ -17,7 +17,7 @@ The latest version of Railties can be installed with RubyGems:
|
|
17
17
|
|
18
18
|
Source code can be downloaded as part of the Rails project on GitHub
|
19
19
|
|
20
|
-
* https://github.com/rails/rails/tree/
|
20
|
+
* https://github.com/rails/rails/tree/master/railties
|
21
21
|
|
22
22
|
== License
|
23
23
|
|
@@ -29,7 +29,7 @@ Railties is released under the MIT license:
|
|
29
29
|
|
30
30
|
API documentation is at
|
31
31
|
|
32
|
-
*
|
32
|
+
* https://api.rubyonrails.org
|
33
33
|
|
34
34
|
Bug reports can be filed for the Ruby on Rails project here:
|
35
35
|
|
@@ -37,4 +37,4 @@ Bug reports can be filed for the Ruby on Rails project here:
|
|
37
37
|
|
38
38
|
Feature requests should be discussed on the rails-core mailing list here:
|
39
39
|
|
40
|
-
* https://
|
40
|
+
* https://discuss.rubyonrails.org/c/rubyonrails-core
|