railties 6.0.6.1 → 6.1.0.rc1

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