railties 6.0.4 → 6.1.4

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