railties 6.0.3.3 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +234 -370
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.rdoc +1 -1
  5. data/lib/minitest/rails_plugin.rb +16 -1
  6. data/lib/rails.rb +5 -8
  7. data/lib/rails/application.rb +49 -83
  8. data/lib/rails/application/bootstrap.rb +5 -5
  9. data/lib/rails/application/configuration.rb +71 -21
  10. data/lib/rails/application/default_middleware_stack.rb +5 -3
  11. data/lib/rails/application/finisher.rb +15 -2
  12. data/lib/rails/application/routes_reloader.rb +9 -2
  13. data/lib/rails/backtrace_cleaner.rb +12 -7
  14. data/lib/rails/code_statistics.rb +3 -3
  15. data/lib/rails/code_statistics_calculator.rb +6 -6
  16. data/lib/rails/command.rb +7 -1
  17. data/lib/rails/command/base.rb +1 -1
  18. data/lib/rails/command/behavior.rb +1 -1
  19. data/lib/rails/command/environment_argument.rb +1 -1
  20. data/lib/rails/commands/credentials/USAGE +17 -2
  21. data/lib/rails/commands/credentials/credentials_command.rb +28 -4
  22. data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
  23. data/lib/rails/commands/db/system/change/change_command.rb +6 -1
  24. data/lib/rails/commands/dbconsole/dbconsole_command.rb +61 -58
  25. data/lib/rails/commands/encrypted/encrypted_command.rb +4 -4
  26. data/lib/rails/commands/generate/generate_command.rb +1 -1
  27. data/lib/rails/commands/notes/notes_command.rb +1 -11
  28. data/lib/rails/commands/rake/rake_command.rb +9 -8
  29. data/lib/rails/commands/secrets/USAGE +9 -3
  30. data/lib/rails/commands/server/server_command.rb +14 -41
  31. data/lib/rails/commands/test/test_command.rb +2 -2
  32. data/lib/rails/configuration.rb +40 -10
  33. data/lib/rails/engine.rb +35 -32
  34. data/lib/rails/engine/configuration.rb +1 -0
  35. data/lib/rails/engine/updater.rb +1 -1
  36. data/lib/rails/gem_version.rb +3 -3
  37. data/lib/rails/generators.rb +29 -15
  38. data/lib/rails/generators/actions.rb +50 -29
  39. data/lib/rails/generators/actions/create_migration.rb +5 -0
  40. data/lib/rails/generators/app_base.rb +38 -21
  41. data/lib/rails/generators/base.rb +14 -11
  42. data/lib/rails/generators/database.rb +3 -4
  43. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +3 -3
  44. data/lib/rails/generators/generated_attribute.rb +3 -9
  45. data/lib/rails/generators/migration.rb +2 -1
  46. data/lib/rails/generators/model_helpers.rb +26 -2
  47. data/lib/rails/generators/named_base.rb +1 -1
  48. data/lib/rails/generators/rails/app/USAGE +2 -1
  49. data/lib/rails/generators/rails/app/app_generator.rb +89 -15
  50. data/lib/rails/generators/rails/app/templates/Gemfile.tt +11 -11
  51. data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
  52. data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +1 -1
  53. data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +11 -11
  54. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +2 -1
  55. data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
  56. data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
  57. data/lib/rails/generators/rails/app/templates/bin/setup.tt +4 -4
  58. data/lib/rails/generators/rails/app/templates/bin/spring.tt +13 -0
  59. data/lib/rails/generators/rails/app/templates/bin/yarn.tt +9 -3
  60. data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
  61. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +14 -7
  62. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
  63. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +3 -4
  64. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +10 -9
  65. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +11 -10
  66. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +10 -9
  67. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +11 -10
  68. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +11 -10
  69. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +10 -9
  70. data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
  71. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +17 -3
  72. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +15 -5
  73. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +12 -1
  74. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
  75. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
  76. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +67 -0
  77. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
  78. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +6 -1
  79. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
  80. data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
  81. data/lib/rails/generators/rails/app/templates/gitignore.tt +0 -1
  82. data/lib/rails/generators/rails/app/templates/package.json.tt +1 -1
  83. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +5 -5
  84. data/lib/rails/generators/rails/assets/USAGE +2 -3
  85. data/lib/rails/generators/rails/benchmark/USAGE +19 -0
  86. data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
  87. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
  88. data/lib/rails/generators/rails/controller/USAGE +2 -2
  89. data/lib/rails/generators/rails/controller/controller_generator.rb +2 -40
  90. data/lib/rails/generators/rails/credentials/credentials_generator.rb +1 -1
  91. data/lib/rails/generators/rails/generator/USAGE +2 -2
  92. data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
  93. data/lib/rails/generators/rails/helper/USAGE +2 -3
  94. data/lib/rails/generators/rails/integration_test/USAGE +2 -2
  95. data/lib/rails/generators/rails/migration/USAGE +4 -4
  96. data/lib/rails/generators/rails/model/USAGE +15 -16
  97. data/lib/rails/generators/rails/plugin/plugin_generator.rb +25 -23
  98. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +10 -19
  99. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
  100. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
  101. data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
  102. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +3 -3
  103. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +13 -11
  104. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
  105. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +1 -1
  106. data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
  107. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
  108. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -3
  109. data/lib/rails/generators/rails/resource/USAGE +4 -4
  110. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
  111. data/lib/rails/generators/rails/scaffold/USAGE +5 -5
  112. data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
  113. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +6 -0
  114. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -1
  115. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +1 -1
  116. data/lib/rails/generators/rails/system_test/USAGE +2 -2
  117. data/lib/rails/generators/rails/task/USAGE +3 -3
  118. data/lib/rails/generators/test_case.rb +1 -1
  119. data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
  120. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
  121. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +2 -2
  122. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
  123. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
  124. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
  125. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +1 -1
  126. data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
  127. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
  128. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
  129. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +1 -1
  130. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
  131. data/lib/rails/generators/testing/assertions.rb +2 -2
  132. data/lib/rails/generators/testing/behaviour.rb +1 -1
  133. data/lib/rails/info.rb +1 -1
  134. data/lib/rails/info_controller.rb +1 -1
  135. data/lib/rails/mailers_controller.rb +1 -0
  136. data/lib/rails/paths.rb +14 -6
  137. data/lib/rails/rack/logger.rb +1 -1
  138. data/lib/rails/railtie.rb +32 -10
  139. data/lib/rails/railtie/configuration.rb +3 -2
  140. data/lib/rails/source_annotation_extractor.rb +1 -15
  141. data/lib/rails/tasks.rb +0 -4
  142. data/lib/rails/tasks/engine.rake +1 -4
  143. data/lib/rails/tasks/framework.rake +7 -1
  144. data/lib/rails/tasks/misc.rake +1 -1
  145. data/lib/rails/tasks/statistics.rake +1 -1
  146. data/lib/rails/tasks/yarn.rake +14 -2
  147. data/lib/rails/templates/rails/mailers/email.html.erb +1 -0
  148. data/lib/rails/templates/rails/welcome/index.html.erb +1 -1
  149. data/lib/rails/test_unit/reporter.rb +2 -1
  150. data/lib/rails/test_unit/runner.rb +20 -3
  151. data/lib/rails/test_unit/testing.rake +6 -0
  152. metadata +27 -33
  153. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
  154. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
  155. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
  156. data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
  157. data/lib/rails/tasks/annotations.rake +0 -22
  158. data/lib/rails/tasks/dev.rake +0 -11
  159. data/lib/rails/tasks/initializers.rake +0 -9
  160. data/lib/rails/tasks/routes.rake +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df91d5063905c148ad6f75e6e2f2b573b2495aca33221bd9ed4f1a362a83322a
4
- data.tar.gz: 25e7c77ded27d4108745bcaf4be47d60cee2d09191b8d92a049a29f7a2d089b2
3
+ metadata.gz: 8e4b20eb9abd2c8e71d7c802b1adc936d2e0e3fa7afed6c547c95389bb31952a
4
+ data.tar.gz: efbbfbb14c05be75a8eff3da93a93cb7a53e9aafd357a9af14bd262b50b5f7a8
5
5
  SHA512:
6
- metadata.gz: 21eafb42e1eaa1f916dec8ca2e9ac685290d202a5f2615fc9b31e5db0b0975666c5da2ebd326f166811e4dbef7fa8107da877ff88fd8f4bcc8f4d5d4cd8b0fb1
7
- data.tar.gz: 554856eddb32ddfbb6bd4b5d0cca084353953e74794bdf329fc25bf70befd07b65c823aec745c558042ea6bae392d7c4dc1645a7176b9c5a45b1a2f8187140bb
6
+ metadata.gz: beeedae94ff8b9e2f457a988901f9c917ef4f6d1003d98a1fc0fa01ac9f8c314d22d386b9fc2a4b2aae3d9bbcfa3f4621b844c10c4d2f3f28fe0775b30322a55
7
+ data.tar.gz: 37b5a5f78bc733c05f52e071bcbc83f50894bdaa26a2a5fa60f779512640fc2b5463f436ed8073c0f5effe4dfe3dc23a02cde10296b062c787b1e6ef004809a1
@@ -1,520 +1,384 @@
1
- ## Rails 6.0.3.3 (September 09, 2020) ##
1
+ ## Rails 6.1.1 (January 07, 2021) ##
2
2
 
3
- * No changes.
3
+ * Allow spaces in path to Yarn binstub and only run on precompile if needed.
4
4
 
5
+ *Markus Doits*
5
6
 
6
- ## Rails 6.0.3.2 (June 17, 2020) ##
7
+ * Populate ARGV for app template.
7
8
 
8
- * No changes.
9
+ Fixes #40945.
9
10
 
11
+ *Jonathan Hefner*
10
12
 
11
- ## Rails 6.0.3.1 (May 18, 2020) ##
12
13
 
13
- * No changes.
14
+ ## Rails 6.1.0 (December 09, 2020) ##
14
15
 
16
+ * Added `Railtie#server` hook called when Rails starts a server.
17
+ This is useful in case your application or a library needs to run
18
+ another process next to the Rails server. This is quite common in development
19
+ for instance to run the Webpack or the React server.
15
20
 
16
- ## Rails 6.0.3 (May 06, 2020) ##
21
+ It can be used like this:
17
22
 
18
- * Cache compiled view templates when running tests by default
19
-
20
- When generating a new app without `--skip-spring`, caching classes is
21
- disabled in `environments/test.rb`. This implicitly disables caching
22
- view templates too. This change will enable view template caching by
23
- adding this to the generated `environments/test.rb`:
24
-
25
- ````ruby
26
- config.action_view.cache_template_loading = true
27
- ````
28
-
29
- *Jorge Manrubia*
30
-
31
- * `Rails::Application#eager_load!` is available again to load application code
32
- manually as it was possible in previous versions.
33
-
34
- Please, note this is not integrated with the whole eager loading logic that
35
- runs when Rails boots with eager loading enabled, you can think of this
36
- method as a vanilla recursive code loader.
37
-
38
- This ability has been restored because there are some use cases for it, such
39
- as indexers that need to have all application classes and modules in memory.
23
+ ```ruby
24
+ class MyRailtie < Rails::Railtie
25
+ server do
26
+ WebpackServer.run
27
+ end
28
+ end
29
+ ```
40
30
 
41
- *Xavier Noria*
31
+ *Edouard Chin*
42
32
 
43
- * Generators that inherit from NamedBase respect `--force` option
33
+ * Remove deprecated `rake dev:cache` tasks.
44
34
 
45
- *Josh Brody*
35
+ *Rafael Mendonça França*
46
36
 
47
- * Regression fix: The Rake task `zeitwerk:check` supports eager loaded
48
- namespaces which do not have eager load paths, like the recently added
49
- `i18n`. These namespaces are only required to respond to `eager_load!`.
50
-
51
- *Xavier Noria*
37
+ * Remove deprecated `rake routes` tasks.
52
38
 
39
+ *Rafael Mendonça França*
53
40
 
54
- ## Rails 6.0.2.2 (March 19, 2020) ##
41
+ * Remove deprecated `rake initializers` tasks.
55
42
 
56
- * No changes.
43
+ *Rafael Mendonça França*
57
44
 
45
+ * Remove deprecated support for using the `HOST` environment variable to specify the server IP.
58
46
 
59
- ## Rails 6.0.2.1 (December 18, 2019) ##
47
+ *Rafael Mendonça França*
60
48
 
61
- * No changes.
49
+ * Remove deprecated `server` argument from the rails server command.
62
50
 
51
+ *Rafael Mendonça França*
63
52
 
64
- ## Rails 6.0.2 (December 13, 2019) ##
53
+ * Remove deprecated `SOURCE_ANNOTATION_DIRECTORIES` environment variable support from `rails notes`.
65
54
 
66
- * Fix the collision check for the scaffold generator.
55
+ *Rafael Mendonça França*
67
56
 
68
- *Ryan Robeson*
57
+ * Remove deprecated `connection` option in the `rails dbconsole` command.
69
58
 
70
- ## Rails 6.0.1 (November 5, 2019) ##
59
+ *Rafael Mendonça França*
71
60
 
72
- * The `zeitwerk:check` Rake task reports files outside the app's root
73
- directory, as in engines loaded from gems.
61
+ * Remove depreated `rake notes` tasks.
74
62
 
75
- *Xavier Noria*
63
+ *Rafael Mendonça França*
76
64
 
77
- * Fixed a possible error when using the evented file update checker.
65
+ * Return a 405 Method Not Allowed response when a request uses an unknown HTTP method.
78
66
 
79
- *Yuji Yaginuma*
67
+ Fixes #38998.
80
68
 
81
- * The sqlite3 database files created by the parallel testing feature are
82
- included in the default `.gitignore` file for newly-generated apps.
69
+ *Loren Norman*
83
70
 
84
- *Yasuo Honda*
71
+ * Make railsrc file location xdg-specification compliant
85
72
 
86
- * `rails new` generates a `.keep` file in `tmp/pids`. This fixes starting
87
- a server via `rackup` instead of `rails server`.
73
+ `rails new` will now look for the default `railsrc` file at
74
+ `$XDG_CONFIG_HOME/rails/railsrc` (or `~/.config/rails/railsrc` if
75
+ `XDG_CONFIG_HOME` is not set). If this file does not exist, `rails new`
76
+ will fall back to `~/.railsrc`.
88
77
 
89
- *Rafael Mendonça França*
78
+ The fallback behaviour means this does not cause any breaking changes.
90
79
 
80
+ *Nick Wolf*
91
81
 
92
- ## Rails 6.0.0 (August 16, 2019) ##
82
+ * Change the default logging level from :debug to :info to avoid inadvertent exposure of personally
83
+ identifiable information (PII) in production environments.
93
84
 
94
- * `Rails.autoloaders.log!` is a logging shortcut to get the activity of the
95
- loaders printed to standard output. May be handy for troubleshooting.
85
+ *Eric M. Payne*
96
86
 
97
- *Xavier Noria*
87
+ * Automatically generate abstract class when using multiple databases.
98
88
 
89
+ 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.
99
90
 
100
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
91
+ Usage:
101
92
 
102
- * The new configuration point `config.add_autoload_paths_to_load_path` allows
103
- users to opt-out from adding autoload paths to `$LOAD_PATH`. This flag is
104
- `true` by default, but it is recommended to be set to `false` in `:zeitwerk`
105
- mode early, in `config/application.rb`.
93
+ ```bash
94
+ $ bin/rails generate scaffold Pet name:string --database=animals
95
+ ```
106
96
 
107
- Zeitwerk uses only absolute paths internally, and applications running in
108
- `:zeitwerk` mode do not need `require_dependency`, so models, controllers,
109
- jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves
110
- Ruby from checking these directories when resolving `require` calls with
111
- relative paths, and saves Bootsnap work and RAM, since it does not need to
112
- build an index for them.
97
+ Will create an abstract class for the animals connection.
113
98
 
114
- *Xavier Noria*
99
+ ```ruby
100
+ class AnimalsRecord < ApplicationRecord
101
+ self.abstract_class = true
115
102
 
116
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
103
+ connects_to database: { writing: :animals }
104
+ end
105
+ ```
117
106
 
118
- * Applications upgrading to Rails 6 can run the command
107
+ And generate a `Pet` model that inherits from the new `AnimalsRecord`:
119
108
 
120
- ```
121
- bin/rails zeitwerk:check
109
+ ```ruby
110
+ class Pet < AnimalsRecord
111
+ end
122
112
  ```
123
113
 
124
- to check if the project structure they were using with the classic
125
- autoloader is compatible with `:zeitwerk` mode.
114
+ 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.
126
115
 
127
- *Matilda Smeds* & *Xavier Noria*
116
+ ```bash
117
+ $ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
118
+ ```
128
119
 
129
- * Allow loading seeds without ActiveJob.
120
+ This will ensure the model inherits from the `SecondaryBase` parent instead of `AnimalsRecord`
130
121
 
131
- Fixes #35782
122
+ ```ruby
123
+ class Pet < SecondaryBase
124
+ end
125
+ ```
132
126
 
133
- *Jeremy Weathers*
127
+ *Eileen M. Uchitelle*, *John Crepezzi*
134
128
 
135
- * `null: false` is set in the migrations by default for column pointed by
136
- `belongs_to` / `references` association generated by model generator.
129
+ * Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
137
130
 
138
- Also deprecate passing {required} to the model generator.
131
+ *Chris Oliver*
139
132
 
140
- *Prathamesh Sonpatki*
133
+ * Create a new rails app using a minimal stack.
141
134
 
142
- * New applications get `config.cache_classes = false` in `config/environments/test.rb`
143
- unless `--skip-spring`.
135
+ `rails new cool_app --minimal`
144
136
 
145
- *Xavier Noria*
137
+ All the following are excluded from your minimal stack:
146
138
 
147
- * Autoloading during initialization is deprecated.
139
+ - action_cable
140
+ - action_mailbox
141
+ - action_mailer
142
+ - action_text
143
+ - active_job
144
+ - active_storage
145
+ - bootsnap
146
+ - jbuilder
147
+ - spring
148
+ - system_tests
149
+ - turbolinks
150
+ - webpack
148
151
 
149
- *Xavier Noria*
152
+ *Haroon Ahmed*, *DHH*
150
153
 
151
- * Only force `:async` ActiveJob adapter to `:inline` during seeding.
154
+ * Add default ENV variable option with BACKTRACE to turn off backtrace cleaning when debugging framework code in the
155
+ generated config/initializers/backtrace_silencers.rb.
152
156
 
153
- *BatedUrGonnaDie*
157
+ `BACKTRACE=1 ./bin/rails runner "MyClass.perform"`
154
158
 
155
- * The `connection` option of `rails dbconsole` command is deprecated in
156
- favor of `database` option.
159
+ *DHH*
157
160
 
158
- *Yuji Yaginuma*
161
+ * The autoloading guide for Zeitwerk mode documents how to autoload classes
162
+ during application boot in a safe way.
159
163
 
160
- * Replace `chromedriver-helper` gem with `webdrivers` in default Gemfile.
161
- `chromedriver-helper` is deprecated as of March 31, 2019 and won't
162
- receive any further updates.
164
+ *Haroon Ahmed*, *Xavier Noria*
163
165
 
164
- *Guillermo Iguaran‮*
166
+ * The `classic` autoloader starts its deprecation cycle.
165
167
 
166
- * Applications running in `:zeitwerk` mode that use `bootsnap` need
167
- to upgrade `bootsnap` to at least 1.4.2.
168
+ 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.
168
169
 
169
170
  *Xavier Noria*
170
171
 
171
- * Add `config.disable_sandbox` option to Rails console.
172
-
173
- This setting will disable `rails console --sandbox` mode, preventing
174
- developer from accidentally starting a sandbox console,
175
- which when left inactive, can cause the database server to run out of memory.
172
+ * Adds `rails test:all` for running all tests in the test directory.
176
173
 
177
- *Prem Sichanugrist*
174
+ This runs all test files in the test directory, including system tests.
178
175
 
179
- * Add `-e/--environment` option to `rails initializers`.
180
-
181
- *Yuji Yaginuma*
176
+ *Niklas Häusele*
182
177
 
178
+ * Add `config.generators.after_generate` for processing to generated files.
183
179
 
184
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
180
+ Register a callback that will get called right after generators has finished.
185
181
 
186
- * Generate random development secrets
182
+ *Yuji Yaginuma*
187
183
 
188
- A random development secret is now generated to tmp/development_secret.txt
184
+ * Make test file patterns configurable via Environment variables
189
185
 
190
- This avoids an issue where development mode servers were vulnerable to
191
- remote code execution.
186
+ This makes test file patterns configurable via two environment variables:
187
+ `DEFAULT_TEST`, to configure files to test, and `DEFAULT_TEST_EXCLUDE`,
188
+ to configure files to exclude from testing.
192
189
 
193
- Fixes CVE-2019-5420
190
+ These values were hardcoded before, which made it difficult to add
191
+ new categories of tests that should not be executed by default (e.g:
192
+ smoke tests).
194
193
 
195
- *Eileen M. Uchitelle*, *Aaron Patterson*, *John Hawthorn*
194
+ *Jorge Manrubia*
196
195
 
196
+ * No longer include `rake rdoc` task when generating plugins.
197
197
 
198
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
198
+ To generate docs, use the `rdoc lib` command instead.
199
199
 
200
- * Fix non-symbol access to nested hashes returned from `Rails::Application.config_for`
201
- being broken by allowing non-symbol access with a deprecation notice.
200
+ *Jonathan Hefner*
202
201
 
203
- *Ufuk Kayserilioglu*
202
+ * Allow relative paths with trailing slashes to be passed to `rails test`.
204
203
 
205
- * Fix deeply nested namespace command printing.
204
+ *Eugene Kenny*
206
205
 
207
- *Gannon McGibbon*
206
+ * Add `rack-mini-profiler` gem to the default `Gemfile`.
208
207
 
208
+ `rack-mini-profiler` displays performance information such as SQL time and flame graphs.
209
+ It's enabled by default in development environment, but can be enabled in production as well.
210
+ See the gem [README](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md) for information on how to enable it in production.
209
211
 
210
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
212
+ *Osama Sayegh*
211
213
 
212
- * Remove deprecated `after_bundle` helper inside plugins templates.
214
+ * `rails stats` will now count TypeScript files toward JavaScript stats.
213
215
 
214
- *Rafael Mendonça França*
216
+ *Joshua Cody*
215
217
 
216
- * Remove deprecated support to old `config.ru` that use the application class as argument of `run`.
218
+ * Run `git init` when generating plugins.
217
219
 
218
- *Rafael Mendonça França*
220
+ Opt out with `--skip-git`.
219
221
 
220
- * Remove deprecated `environment` argument from the rails commands.
222
+ *OKURA Masafumi*
221
223
 
222
- *Rafael Mendonça França*
224
+ * Add benchmark generator.
223
225
 
224
- * Remove deprecated `capify!`.
226
+ Introduce benchmark generator to benchmark Rails applications.
225
227
 
226
- *Rafael Mendonça França*
228
+ `rails generate benchmark opt_compare`
227
229
 
228
- * Remove deprecated `config.secret_token`.
230
+ This creates a benchmark file that uses [`benchmark-ips`](https://github.com/evanphx/benchmark-ips).
231
+ By default, two code blocks can be benchmarked using the `before` and `after` reports.
229
232
 
230
- *Rafael Mendonça França*
233
+ You can run the generated benchmark file using:
234
+ `ruby script/benchmarks/opt_compare.rb`
231
235
 
232
- * Seed database with inline ActiveJob job adapter.
236
+ *Kevin Jalbert*, *Gannon McGibbon*
233
237
 
234
- *Gannon McGibbon*
238
+ * Cache compiled view templates when running tests by default.
235
239
 
236
- * Add `rails db:system:change` command for changing databases.
240
+ When generating a new app without `--skip-spring`, caching classes is
241
+ disabled in `environments/test.rb`. This implicitly disables caching
242
+ view templates too. This change will enable view template caching by
243
+ adding this to the generated `environments/test.rb`:
237
244
 
245
+ ```ruby
246
+ config.action_view.cache_template_loading = true
238
247
  ```
239
- bin/rails db:system:change --to=postgresql
240
- force config/database.yml
241
- gsub Gemfile
242
- ```
243
-
244
- The change command copies a template `config/database.yml` with
245
- the target database adapter into your app, and replaces your database gem
246
- with the target database gem.
247
-
248
- *Gannon McGibbon*
249
-
250
- * Add `rails test:channels`.
251
-
252
- *bogdanvlviv*
253
-
254
- * Use original `bundler` environment variables during the process of generating a new rails project.
255
-
256
- *Marco Costa*
257
-
258
- * Send Active Storage analysis and purge jobs to dedicated queues by default.
259
-
260
- Analysis jobs now use the `:active_storage_analysis` queue, and purge jobs
261
- now use the `:active_storage_purge` queue. This matches Action Mailbox,
262
- which sends its jobs to dedicated queues by default.
263
-
264
- *George Claghorn*
265
-
266
- * Add `rails test:mailboxes`.
267
-
268
- *George Claghorn*
269
248
 
270
- * Introduce guard against DNS rebinding attacks.
271
-
272
- The `ActionDispatch::HostAuthorization` is a new middleware that prevents
273
- against DNS rebinding and other `Host` header attacks. It is included in
274
- the development environment by default with the following configuration:
275
-
276
- Rails.application.config.hosts = [
277
- IPAddr.new("0.0.0.0/0"), # All IPv4 addresses.
278
- IPAddr.new("::/0"), # All IPv6 addresses.
279
- "localhost" # The localhost reserved domain.
280
- ]
281
-
282
- In other environments `Rails.application.config.hosts` is empty and no
283
- `Host` header checks will be done. If you want to guard against header
284
- attacks on production, you have to manually permit the allowed hosts
285
- with:
249
+ *Jorge Manrubia*
286
250
 
287
- Rails.application.config.hosts << "product.com"
251
+ * Introduce middleware move operations.
288
252
 
289
- The host of a request is checked against the `hosts` entries with the case
290
- operator (`#===`), which lets `hosts` support entries of type `Regexp`,
291
- `Proc` and `IPAddr` to name a few. Here is an example with a regexp.
253
+ With this change, you no longer need to delete and reinsert a middleware to
254
+ move it from one place to another in the stack:
292
255
 
293
- # Allow requests from subdomains like `www.product.com` and
294
- # `beta1.product.com`.
295
- Rails.application.config.hosts << /.*\.product\.com/
256
+ ```ruby
257
+ config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
258
+ ```
296
259
 
297
- A special case is supported that allows you to permit all sub-domains:
260
+ This will move the `Magical::Unicorns` middleware before
261
+ `ActionDispatch::Flash`. You can also move it after with:
298
262
 
299
- # Allow requests from subdomains like `www.product.com` and
300
- # `beta1.product.com`.
301
- Rails.application.config.hosts << ".product.com"
263
+ ```ruby
264
+ config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
265
+ ```
302
266
 
303
267
  *Genadi Samokovarov*
304
268
 
305
- * Remove redundant suffixes on generated helpers.
306
-
307
- *Gannon McGibbon*
308
-
309
- * Remove redundant suffixes on generated integration tests.
310
-
311
- *Gannon McGibbon*
312
-
313
- * Fix boolean interaction in scaffold system tests.
314
-
315
- *Gannon McGibbon*
316
-
317
- * Remove redundant suffixes on generated system tests.
318
-
319
- *Gannon McGibbon*
320
-
321
- * Add an `abort_on_failure` boolean option to the generator method that shell
322
- out (`generate`, `rake`, `rails_command`) to abort the generator if the
323
- command fails.
324
-
325
- *David Rodríguez*
326
-
327
- * Remove `app/assets` and `app/javascript` from `eager_load_paths` and `autoload_paths`.
328
-
329
- *Gannon McGibbon*
269
+ * Generators that inherit from NamedBase respect `--force` option.
330
270
 
331
- * Use Ids instead of memory addresses when displaying references in scaffold views.
332
-
333
- Fixes #29200.
271
+ *Josh Brody*
334
272
 
335
- *Rasesh Patel*
273
+ * Allow configuration of eager_load behaviour for rake environment:
336
274
 
337
- * Adds support for multiple databases to `rails db:migrate:status`.
338
- Subtasks are also added to get the status of individual databases (eg. `rails db:migrate:status:animals`).
275
+ config.rake_eager_load
339
276
 
340
- *Gannon McGibbon*
277
+ Defaults to `false` as per previous behaviour.
341
278
 
342
- * Use Webpacker by default to manage app-level JavaScript through the new app/javascript directory.
343
- Sprockets is now solely in charge, by default, of compiling CSS and other static assets.
344
- Action Cable channel generators will create ES6 stubs rather than use CoffeeScript.
345
- Active Storage, Action Cable, Turbolinks, and Rails-UJS are loaded by a new application.js pack.
346
- Generators no longer generate JavaScript stubs.
279
+ *Thierry Joyal*
347
280
 
348
- *DHH*, *Lachlan Sylvester*
281
+ * Ensure Rails migration generator respects system-wide primary key config.
349
282
 
350
- * Add `database` (aliased as `db`) option to model generator to allow
351
- setting the database. This is useful for applications that use
352
- multiple databases and put migrations per database in their own directories.
283
+ When rails is configured to use a specific primary key type:
353
284
 
285
+ ```ruby
286
+ config.generators do |g|
287
+ g.orm :active_record, primary_key_type: :uuid
288
+ end
354
289
  ```
355
- bin/rails g model Room capacity:integer --database=kingston
356
- invoke active_record
357
- create db/kingston_migrate/20180830151055_create_rooms.rb
358
- ```
359
-
360
- Because rails scaffolding uses the model generator, you can
361
- also specify a database with the scaffold generator.
362
-
363
- *Gannon McGibbon*
364
-
365
- * Raise an error when "recyclable cache keys" are being used by a cache store
366
- that does not explicitly support it. Custom cache keys that do support this feature
367
- can bypass this error by implementing the `supports_cache_versioning?` method on their
368
- class and returning a truthy value.
369
-
370
- *Richard Schneeman*
371
-
372
- * Support environment specific credentials overrides.
373
-
374
- So any environment will look for `config/credentials/#{Rails.env}.yml.enc` and fall back
375
- to `config/credentials.yml.enc`.
376
-
377
- The encryption key can be in `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key`.
378
-
379
- Environment credentials overrides can be edited with `rails credentials:edit --environment production`.
380
- If no override is set up for the passed environment, it will be created.
381
-
382
- Additionally, the default lookup paths can be overwritten with these configs:
383
-
384
- - `config.credentials.content_path`
385
- - `config.credentials.key_path`
386
-
387
- *Wojciech Wnętrzak*
388
-
389
- * Make `ActiveSupport::Cache::NullStore` the default cache store in the test environment.
390
-
391
- *Michael C. Nelson*
392
290
 
393
- * Emit warning for unknown inflection rule when generating model.
394
-
395
- *Yoshiyuki Kinjo*
396
-
397
- * Add `database` (aliased as `db`) option to migration generator.
398
-
399
- If you're using multiple databases and have a folder for each database
400
- for migrations (ex db/migrate and db/new_db_migrate) you can now pass the
401
- `--database` option to the generator to make sure the the migration
402
- is inserted into the correct folder.
291
+ Previously:
403
292
 
293
+ ```bash
294
+ $ bin/rails g migration add_location_to_users location:references
404
295
  ```
405
- rails g migration CreateHouses --database=kingston
406
- invoke active_record
407
- create db/kingston_migrate/20180830151055_create_houses.rb
408
- ```
409
-
410
- *Eileen M. Uchitelle*
411
-
412
- * Deprecate `rake routes` in favor of `rails routes`.
413
-
414
- *Yuji Yaginuma*
415
-
416
- * Deprecate `rake initializers` in favor of `rails initializers`.
417
-
418
- *Annie-Claude Côté*
419
-
420
- * Deprecate `rake dev:cache` in favor of `rails dev:cache`.
421
-
422
- *Annie-Claude Côté*
423
-
424
- * Deprecate `rails notes` subcommands in favor of passing an `annotations` argument to `rails notes`.
425
-
426
- The following subcommands are replaced by passing `--annotations` or `-a` to `rails notes`:
427
- - `rails notes:custom ANNOTATION=custom` is deprecated in favor of using `rails notes -a custom`.
428
- - `rails notes:optimize` is deprecated in favor of using `rails notes -a OPTIMIZE`.
429
- - `rails notes:todo` is deprecated in favor of using`rails notes -a TODO`.
430
- - `rails notes:fixme` is deprecated in favor of using `rails notes -a FIXME`.
431
-
432
- *Annie-Claude Côté*
433
296
 
434
- * Deprecate `SOURCE_ANNOTATION_DIRECTORIES` environment variable used by `rails notes`
435
- through `Rails::SourceAnnotationExtractor::Annotation` in favor of using `config.annotations.register_directories`.
297
+ The references line in the migration would not have `type: :uuid`.
298
+ This change causes the type to be applied appropriately.
436
299
 
437
- *Annie-Claude Côté*
300
+ *Louis-Michel Couture*, *Dermot Haughey*
438
301
 
439
- * Deprecate `rake notes` in favor of `rails notes`.
302
+ * Deprecate `Rails::DBConsole#config`.
440
303
 
441
- *Annie-Claude Côté*
304
+ `Rails::DBConsole#config` is deprecated without replacement. Use `Rails::DBConsole.db_config.configuration_hash` instead.
442
305
 
443
- * Don't generate unused files in `app:update` task.
306
+ *Eileen M. Uchitelle*, *John Crepezzi*
444
307
 
445
- Skip the assets' initializer when sprockets isn't loaded.
308
+ * `Rails.application.config_for` merges shared configuration deeply.
446
309
 
447
- Skip `config/spring.rb` when spring isn't loaded.
448
-
449
- Skip yarn's contents when yarn integration isn't used.
450
-
451
- *Tsukuru Tanimichi*
452
-
453
- * Make the master.key file read-only for the owner upon generation on
454
- POSIX-compliant systems.
455
-
456
- Previously:
457
-
458
- $ ls -l config/master.key
459
- -rw-r--r-- 1 owner group 32 Jan 1 00:00 master.key
460
-
461
- Now:
310
+ ```yaml
311
+ # config/example.yml
312
+ shared:
313
+ foo:
314
+ bar:
315
+ baz: 1
316
+ development:
317
+ foo:
318
+ bar:
319
+ qux: 2
320
+ ```
462
321
 
463
- $ ls -l config/master.key
464
- -rw------- 1 owner group 32 Jan 1 00:00 master.key
322
+ ```ruby
323
+ # Previously
324
+ Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 }
465
325
 
466
- Fixes #32604.
326
+ # Now
327
+ Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
328
+ ```
467
329
 
468
- *Jose Luis Duran*
330
+ *Yuhei Kiriyama*
469
331
 
470
- * Deprecate support for using the `HOST` environment variable to specify the server IP.
332
+ * Remove access to values in nested hashes returned by `Rails.application.config_for` via String keys.
471
333
 
472
- The `BINDING` environment variable should be used instead.
334
+ ```yaml
335
+ # config/example.yml
336
+ development:
337
+ options:
338
+ key: value
339
+ ```
473
340
 
474
- Fixes #29516.
341
+ ```ruby
342
+ Rails.application.config_for(:example).options
343
+ ```
475
344
 
476
- *Yuji Yaginuma*
345
+ 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.
477
346
 
478
- * Deprecate passing Rack server name as a regular argument to `rails server`.
347
+ *Étienne Barrié*
479
348
 
480
- Previously:
349
+ * Configuration files for environments (`config/environments/*.rb`) are
350
+ now able to modify `autoload_paths`, `autoload_once_paths`, and
351
+ `eager_load_paths`.
481
352
 
482
- $ bin/rails server thin
353
+ 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.
483
354
 
484
- There wasn't an explicit option for the Rack server to use, now we have the
485
- `--using` option with the `-u` short switch.
355
+ Ways to use application code in these files:
486
356
 
487
- Now:
357
+ * 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.
488
358
 
489
- $ bin/rails server -u thin
359
+ ```ruby
360
+ # In config/application.rb, for example.
361
+ require "#{Rails.root}/lib/my_app/config"
490
362
 
491
- This change also improves the error message if a missing or mistyped rack
492
- server is given.
363
+ # In config/environments/development.rb, for example.
364
+ config.foo = MyApp::Config.foo
365
+ ```
493
366
 
494
- *Genadi Samokovarov*
367
+ * If the class has to be reloadable, then wrap the configuration code in a `to_prepare` block:
495
368
 
496
- * Add "rails routes --expanded" option to output routes in expanded mode like
497
- "psql --expanded". Result looks like:
369
+ ```ruby
370
+ config.to_prepare do
371
+ config.foo = MyModel.foo
372
+ end
373
+ ```
498
374
 
499
- ```
500
- $ rails routes --expanded
501
- --[ Route 1 ]------------------------------------------------------------
502
- Prefix | high_scores
503
- Verb | GET
504
- URI | /high_scores(.:format)
505
- Controller#Action | high_scores#index
506
- --[ Route 2 ]------------------------------------------------------------
507
- Prefix | new_high_score
508
- Verb | GET
509
- URI | /high_scores/new(.:format)
510
- Controller#Action | high_scores#new
511
- ```
375
+ 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.
512
376
 
513
- *Benoit Tigeot*
377
+ *Allen Hsu* & *Xavier Noria*
514
378
 
515
- * Rails 6 requires Ruby 2.5.0 or newer.
379
+ * Support using environment variable to set pidfile.
516
380
 
517
- *Jeremy Daer*, *Kasper Timm Hansen*
381
+ *Ben Thorner*
518
382
 
519
383
 
520
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/railties/CHANGELOG.md) for previous changes.
384
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/railties/CHANGELOG.md) for previous changes.