railties 6.1.6 → 7.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +626 -259
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.md +99 -0
  5. data/README.rdoc +5 -6
  6. data/lib/minitest/rails_plugin.rb +64 -1
  7. data/lib/rails/all.rb +0 -1
  8. data/lib/rails/api/task.rb +35 -4
  9. data/lib/rails/app_updater.rb +9 -6
  10. data/lib/rails/application/bootstrap.rb +41 -7
  11. data/lib/rails/application/configuration.rb +262 -88
  12. data/lib/rails/application/default_middleware_stack.rb +29 -4
  13. data/lib/rails/application/dummy_config.rb +19 -0
  14. data/lib/rails/application/finisher.rb +89 -124
  15. data/lib/rails/application/routes_reloader.rb +8 -0
  16. data/lib/rails/application.rb +200 -125
  17. data/lib/rails/application_controller.rb +3 -3
  18. data/lib/rails/autoloaders/inflector.rb +21 -0
  19. data/lib/rails/autoloaders.rb +42 -42
  20. data/lib/rails/backtrace_cleaner.rb +1 -1
  21. data/lib/rails/cli.rb +5 -2
  22. data/lib/rails/code_statistics.rb +2 -2
  23. data/lib/rails/code_statistics_calculator.rb +10 -1
  24. data/lib/rails/command/actions.rb +10 -12
  25. data/lib/rails/command/base.rb +61 -45
  26. data/lib/rails/command/behavior.rb +1 -1
  27. data/lib/rails/command/environment_argument.rb +33 -17
  28. data/lib/rails/command/helpers/editor.rb +17 -12
  29. data/lib/rails/command.rb +90 -36
  30. data/lib/rails/commands/about/about_command.rb +14 -0
  31. data/lib/rails/commands/application/application_command.rb +2 -0
  32. data/lib/rails/commands/console/console_command.rb +17 -13
  33. data/lib/rails/commands/credentials/USAGE +53 -53
  34. data/lib/rails/commands/credentials/credentials_command/diffing.rb +31 -19
  35. data/lib/rails/commands/credentials/credentials_command.rb +67 -69
  36. data/lib/rails/commands/db/system/change/change_command.rb +2 -1
  37. data/lib/rails/commands/dbconsole/dbconsole_command.rb +26 -117
  38. data/lib/rails/commands/destroy/destroy_command.rb +3 -2
  39. data/lib/rails/commands/dev/dev_command.rb +1 -6
  40. data/lib/rails/commands/encrypted/USAGE +15 -20
  41. data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
  42. data/lib/rails/commands/gem_help/USAGE +16 -0
  43. data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
  44. data/lib/rails/commands/generate/generate_command.rb +2 -2
  45. data/lib/rails/commands/help/USAGE +15 -14
  46. data/lib/rails/commands/help/help_command.rb +21 -2
  47. data/lib/rails/commands/initializers/initializers_command.rb +1 -4
  48. data/lib/rails/commands/middleware/middleware_command.rb +17 -0
  49. data/lib/rails/commands/new/new_command.rb +2 -0
  50. data/lib/rails/commands/notes/notes_command.rb +2 -1
  51. data/lib/rails/commands/plugin/plugin_command.rb +2 -0
  52. data/lib/rails/commands/rake/rake_command.rb +25 -22
  53. data/lib/rails/commands/restart/restart_command.rb +14 -0
  54. data/lib/rails/commands/routes/routes_command.rb +13 -1
  55. data/lib/rails/commands/runner/USAGE +14 -12
  56. data/lib/rails/commands/runner/runner_command.rb +34 -21
  57. data/lib/rails/commands/secret/secret_command.rb +13 -0
  58. data/lib/rails/commands/secrets/USAGE +44 -49
  59. data/lib/rails/commands/secrets/secrets_command.rb +20 -38
  60. data/lib/rails/commands/server/server_command.rb +33 -30
  61. data/lib/rails/commands/test/USAGE +14 -0
  62. data/lib/rails/commands/test/test_command.rb +56 -14
  63. data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
  64. data/lib/rails/commands/version/version_command.rb +1 -0
  65. data/lib/rails/configuration.rb +23 -28
  66. data/lib/rails/console/app.rb +1 -4
  67. data/lib/rails/console/helpers.rb +2 -2
  68. data/lib/rails/deprecator.rb +7 -0
  69. data/lib/rails/engine/configuration.rb +53 -9
  70. data/lib/rails/engine.rb +63 -48
  71. data/lib/rails/gem_version.rb +3 -3
  72. data/lib/rails/generators/actions/create_migration.rb +2 -4
  73. data/lib/rails/generators/actions.rb +231 -73
  74. data/lib/rails/generators/active_model.rb +28 -14
  75. data/lib/rails/generators/app_base.rb +476 -176
  76. data/lib/rails/generators/app_name.rb +3 -14
  77. data/lib/rails/generators/base.rb +24 -20
  78. data/lib/rails/generators/database.rb +39 -1
  79. data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
  80. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -0
  81. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +8 -8
  82. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
  83. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
  84. data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
  85. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
  86. data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
  87. data/lib/rails/generators/erb.rb +1 -1
  88. data/lib/rails/generators/generated_attribute.rb +57 -9
  89. data/lib/rails/generators/migration.rb +2 -7
  90. data/lib/rails/generators/model_helpers.rb +3 -2
  91. data/lib/rails/generators/named_base.rb +13 -13
  92. data/lib/rails/generators/rails/app/USAGE +22 -6
  93. data/lib/rails/generators/rails/app/app_generator.rb +113 -114
  94. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +103 -0
  95. data/lib/rails/generators/rails/app/templates/Gemfile.tt +43 -53
  96. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
  97. data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
  98. data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
  99. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +3 -9
  100. data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
  101. data/lib/rails/generators/rails/app/templates/bin/rails.tt +1 -4
  102. data/lib/rails/generators/rails/app/templates/bin/rake.tt +0 -3
  103. data/lib/rails/generators/rails/app/templates/bin/setup.tt +16 -12
  104. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +6 -18
  105. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +1 -1
  106. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +2 -2
  107. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +3 -3
  108. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +7 -7
  109. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +5 -5
  110. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
  111. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +2 -2
  112. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +7 -9
  113. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +4 -4
  114. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +5 -5
  115. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
  116. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +16 -12
  117. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +38 -61
  118. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +14 -15
  119. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +3 -5
  120. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +21 -28
  121. data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +3 -3
  122. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
  123. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
  124. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +283 -0
  125. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -9
  126. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +13 -15
  127. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +12 -20
  128. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +8 -1
  129. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
  130. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +6 -4
  131. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
  132. data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
  133. data/lib/rails/generators/rails/app/templates/gitattributes.tt +0 -5
  134. data/lib/rails/generators/rails/app/templates/gitignore.tt +7 -9
  135. data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
  136. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
  137. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +10 -8
  138. data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
  139. data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +2 -1
  140. data/lib/rails/generators/rails/controller/USAGE +12 -4
  141. data/lib/rails/generators/rails/controller/controller_generator.rb +6 -2
  142. data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -5
  143. data/lib/rails/generators/rails/credentials/credentials_generator.rb +29 -24
  144. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
  145. data/lib/rails/generators/rails/db/system/change/change_generator.rb +31 -1
  146. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
  147. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
  148. data/lib/rails/generators/rails/migration/USAGE +21 -11
  149. data/lib/rails/generators/rails/model/model_generator.rb +4 -0
  150. data/lib/rails/generators/rails/plugin/USAGE +17 -6
  151. data/lib/rails/generators/rails/plugin/plugin_generator.rb +69 -30
  152. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +7 -3
  153. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +9 -31
  154. data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
  155. data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
  156. data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
  157. data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
  158. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +5 -20
  159. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -7
  160. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
  161. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
  162. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +2 -2
  163. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +6 -11
  164. data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
  165. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -20
  166. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -1
  167. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -5
  168. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +6 -10
  169. data/lib/rails/generators/resource_helpers.rb +2 -2
  170. data/lib/rails/generators/test_case.rb +2 -2
  171. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +1 -1
  172. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +2 -2
  173. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -4
  174. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +5 -5
  175. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +7 -7
  176. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
  177. data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +7 -5
  178. data/lib/rails/generators.rb +14 -29
  179. data/lib/rails/health_controller.rb +55 -0
  180. data/lib/rails/info.rb +2 -2
  181. data/lib/rails/info_controller.rb +31 -13
  182. data/lib/rails/initializable.rb +1 -1
  183. data/lib/rails/mailers_controller.rb +17 -9
  184. data/lib/rails/paths.rb +14 -11
  185. data/lib/rails/rack/logger.rb +16 -15
  186. data/lib/rails/rackup/server.rb +15 -0
  187. data/lib/rails/railtie/configuration.rb +15 -3
  188. data/lib/rails/railtie.rb +54 -31
  189. data/lib/rails/ruby_version_check.rb +5 -3
  190. data/lib/rails/secrets.rb +10 -8
  191. data/lib/rails/source_annotation_extractor.rb +68 -19
  192. data/lib/rails/tasks/engine.rake +8 -8
  193. data/lib/rails/tasks/framework.rake +4 -12
  194. data/lib/rails/tasks/log.rake +1 -1
  195. data/lib/rails/tasks/misc.rake +3 -14
  196. data/lib/rails/tasks/statistics.rake +8 -5
  197. data/lib/rails/tasks/tmp.rake +13 -6
  198. data/lib/rails/tasks/yarn.rake +8 -9
  199. data/lib/rails/tasks/zeitwerk.rake +14 -42
  200. data/lib/rails/tasks.rb +0 -2
  201. data/lib/rails/templates/layouts/application.html.erb +15 -0
  202. data/lib/rails/templates/rails/mailers/email.html.erb +45 -11
  203. data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
  204. data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
  205. data/lib/rails/templates/rails/welcome/index.html.erb +65 -48
  206. data/lib/rails/test_help.rb +13 -14
  207. data/lib/rails/test_unit/line_filtering.rb +1 -1
  208. data/lib/rails/test_unit/railtie.rb +0 -4
  209. data/lib/rails/test_unit/reporter.rb +6 -2
  210. data/lib/rails/test_unit/runner.rb +45 -20
  211. data/lib/rails/test_unit/test_parser.rb +88 -0
  212. data/lib/rails/test_unit/testing.rake +18 -43
  213. data/lib/rails/testing/maintain_test_schema.rb +16 -0
  214. data/lib/rails/version.rb +1 -1
  215. data/lib/rails/welcome_controller.rb +1 -0
  216. data/lib/rails/zeitwerk_checker.rb +15 -0
  217. data/lib/rails.rb +26 -15
  218. metadata +74 -42
  219. data/RDOC_MAIN.rdoc +0 -97
  220. data/lib/rails/.DS_Store +0 -0
  221. data/lib/rails/application/dummy_erb_compiler.rb +0 -18
  222. data/lib/rails/command/spellchecker.rb +0 -57
  223. data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
  224. data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
  225. data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
  226. data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
  227. data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
  228. data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
  229. data/lib/rails/generators/rails/app/templates/bin/spring.tt +0 -13
  230. data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -16
  231. data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
  232. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -8
  233. data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
  234. data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
  235. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +0 -67
  236. data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
  237. data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
  238. data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
  239. data/lib/rails/generators/rails/assets/USAGE +0 -16
  240. data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
  241. data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
  242. data/lib/rails/generators/rails/model/USAGE +0 -113
  243. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
  244. data/lib/rails/tasks/middleware.rake +0 -9
  245. data/lib/rails/tasks/restart.rake +0 -9
data/CHANGELOG.md CHANGED
@@ -1,484 +1,851 @@
1
- ## Rails 6.1.5.1 (April 26, 2022) ##
1
+ ## Rails 7.1.2 (November 10, 2023) ##
2
2
 
3
- * No changes.
3
+ * Fix running `db:system:change` when app has no Dockerfile.
4
4
 
5
+ *Hartley McGuire*
5
6
 
6
- ## Rails 6.1.5 (March 09, 2022) ##
7
+ * If you accessed `config.eager_load_paths` and friends, later changes to
8
+ `config.paths` were not reflected in the expected auto/eager load paths.
9
+ Now, they are.
7
10
 
8
- * In `zeitwerk` mode, setup the `once` autoloader first, and the `main` autoloader after it.
9
- This order plays better with shared namespaces.
11
+ This bug has been latent since Rails 3.
10
12
 
11
- *Xavier Noria*
13
+ Fixes #49629.
12
14
 
13
- * Handle paths with spaces when editing credentials.
15
+ *Xavier Noria*
14
16
 
15
- *Alex Ghiculescu*
17
+ ## Rails 7.1.1 (October 11, 2023) ##
16
18
 
17
- * Support Psych 4 when loading secrets.
19
+ * Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile.
18
20
 
19
- *Nat Morcos*
21
+ *Abhay Nikam*
20
22
 
21
23
 
22
- ## Rails 6.1.4.7 (March 08, 2022) ##
24
+ ## Rails 7.1.0 (October 05, 2023) ##
23
25
 
24
26
  * No changes.
25
27
 
26
28
 
27
- ## Rails 6.1.4.6 (February 11, 2022) ##
29
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
28
30
 
29
- * No changes.
31
+ * Always set the Rails logger to be an instance of `ActiveSupport::BroadcastLogger`.
30
32
 
33
+ *Edouard Chin*
31
34
 
32
- ## Rails 6.1.4.5 (February 11, 2022) ##
33
35
 
34
- * No changes.
36
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
35
37
 
38
+ * Require `concurrent-ruby` in `config/puma.rb` so that Puma can boot in
39
+ production when `WEB_CONCURRENCY` is not explicitly specified.
36
40
 
37
- ## Rails 6.1.4.4 (December 15, 2021) ##
41
+ Fixes #49323.
38
42
 
39
- * No changes.
43
+ *Matt Brictson*
40
44
 
45
+ * Raise error when generating attribute with dangerous name.
41
46
 
42
- ## Rails 6.1.4.3 (December 14, 2021) ##
47
+ The following will now raise an error as `save` and `hash` are already
48
+ defined by Active Record.
43
49
 
44
- * Allow localhost with a port by default in development
50
+ ```bash
51
+ $ bin/rails generate model Post save
52
+ $ bin/rails generate model Post hash
53
+ ```
45
54
 
46
- [Fixes: #43864]
55
+ *Petrik de Heus*
47
56
 
48
- ## Rails 6.1.4.2 (December 14, 2021) ##
49
57
 
50
- * No changes.
58
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
51
59
 
60
+ * Add ability to show slow tests to the test runner
52
61
 
53
- ## Rails 6.1.4.1 (August 19, 2021) ##
62
+ ```bash
63
+ $ bin/test --profile # additionally prints 10 (default) slowest tests
64
+ # or
65
+ $ bin/test --profile 20 # prints 20 slowest tests
66
+ ```
54
67
 
55
- * No changes.
68
+ *fatkodima*
56
69
 
70
+ * `rails new --javascript` generator now supports Bun
57
71
 
58
- ## Rails 6.1.4 (June 24, 2021) ##
72
+ ```bash
73
+ $ rails new my_new_app --javascript=bun
74
+ ```
59
75
 
60
- * Fix compatibility with `psych >= 4`.
76
+ *Jason Meller*
61
77
 
62
- Starting in Psych 4.0.0 `YAML.load` behaves like `YAML.safe_load`. To preserve compatibility
63
- `Rails.application.config_for` now uses `YAML.unsafe_load` if available.
78
+ * bin/setup uses `bun` instead of `yarn` when generated an app with bun
64
79
 
65
- *Jean Boussier*
80
+ Use `bun install` on `bin/setup` when using `bun`.
66
81
 
67
- * Ensure `Rails.application.config_for` always cast hashes to `ActiveSupport::OrderedOptions`.
82
+ *Cadu Ribeiro*
68
83
 
69
- *Jean Boussier*
84
+ * `config/application.rb` now includes
70
85
 
71
- * Fix create migration generator with `--pretend` option.
86
+ ```ruby
87
+ config.autoload_lib(ignore: %w(assets tasks))
88
+ ```
72
89
 
73
- *euxx*
90
+ In practice, this means that new 7.1 applications autoload from `lib` out of the box.
74
91
 
92
+ *Xavier Noria*
75
93
 
76
- ## Rails 6.1.3.2 (May 05, 2021) ##
94
+ * Add an option to start rails console in sandbox mode by default
77
95
 
78
- * No changes.
96
+ `sandbox_by_default` option is added to start rails console in sandbox
97
+ mode by default. With this option turned on, `--no-sandbox` must be
98
+ specified to start rails in non-sandbox mode.
79
99
 
100
+ Note that this option is ignored when rails environment is development
101
+ or test.
80
102
 
81
- ## Rails 6.1.3.1 (March 26, 2021) ##
103
+ *Shouichi Kamiya*
82
104
 
83
- * No changes.
105
+ * Omit `webdrivers` gem dependency from `Gemfile` template
84
106
 
107
+ *Sean Doyle*
85
108
 
86
- ## Rails 6.1.3 (February 17, 2021) ##
109
+ * Support filtering tests by line ranges
87
110
 
88
- * No changes.
111
+ The new syntax allows you to filter tests by line ranges. For example, the
112
+ following command runs tests from line 10 to 20.
89
113
 
114
+ ```bash
115
+ $ rails test test/models/user_test.rb:10-20
116
+ ```
90
117
 
91
- ## Rails 6.1.2.1 (February 10, 2021) ##
118
+ *Shouichi Kamiya*, *Seonggi Yang*, *oljfte*, *Ryohei UEDA*
92
119
 
93
- * No changes.
120
+ * Update default scaffold templates to set 303 (See Other) as status code
121
+ on redirect for the update action for XHR requests other than GET or POST
122
+ to avoid issues (e.g browsers trying to follow the redirect using the
123
+ original request method resulting in double PATCH/PUT)
94
124
 
125
+ *Guillermo Iguaran*
95
126
 
96
- ## Rails 6.1.2 (February 09, 2021) ##
127
+ * The new `config.autoload_lib_once` is similar to `config.autoload_lib`,
128
+ except that it adds `lib` to `config.autoload_once_paths` instead.
97
129
 
98
- * No changes.
130
+ By calling `config.autoload_lib_once`, classes and modules in `lib` can be
131
+ autoloaded, even from application initializers, but won't be reloaded.
99
132
 
133
+ Please, see further details in the [autoloading
134
+ guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
100
135
 
101
- ## Rails 6.1.1 (January 07, 2021) ##
102
-
103
- * Allow spaces in path to Yarn binstub and only run on precompile if needed.
136
+ *Xavier Noria*
104
137
 
105
- *Markus Doits*
138
+ * Add `config.action_dispatch.debug_exception_log_level` to configure the log
139
+ level used by `ActionDispatch::DebugExceptions`.
106
140
 
107
- * Populate ARGV for app template.
141
+ The default is `:fatal`, but with `load_defaults "7.1"` the default will be
142
+ `:error`.
108
143
 
109
- Fixes #40945.
144
+ *Hartley McGuire*
110
145
 
111
- *Jonathan Hefner*
146
+ * Add `DATABASE` option to `railties:install:migrations`
112
147
 
148
+ This allows you to specify which database the migrations should be copied to
149
+ when running `rails railties:install:migrations`.
113
150
 
114
- ## Rails 6.1.0 (December 09, 2020) ##
151
+ ```bash
152
+ $ rails railties:install:migrations DATABASE=animals
153
+ ```
115
154
 
116
- * Added `Railtie#server` hook called when Rails starts a server.
117
- This is useful in case your application or a library needs to run
118
- another process next to the Rails server. This is quite common in development
119
- for instance to run the Webpack or the React server.
155
+ *Matthew Hirst*
120
156
 
121
- It can be used like this:
157
+ * The new method `config.autoload_lib(ignore:)` provides a simple way to
158
+ autoload from `lib`:
122
159
 
123
160
  ```ruby
124
- class MyRailtie < Rails::Railtie
125
- server do
126
- WebpackServer.run
127
- end
128
- end
161
+ # config/application.rb
162
+ config.autoload_lib(ignore: %w(assets tasks))
129
163
  ```
130
164
 
131
- *Edouard Chin*
132
-
133
- * Remove deprecated `rake dev:cache` tasks.
165
+ Please, see further details in the [autoloading
166
+ guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
134
167
 
135
- *Rafael Mendonça França*
168
+ *Xavier Noria*
136
169
 
137
- * Remove deprecated `rake routes` tasks.
170
+ * Don't show secret_key_base for `Rails.application.config#inspect`.
138
171
 
139
- *Rafael Mendonça França*
172
+ Before:
140
173
 
141
- * Remove deprecated `rake initializers` tasks.
174
+ ```ruby
175
+ Rails.application.config.inspect
176
+ "#<Rails::Application::Configuration:0x00000001132b02a0 @root=... @secret_key_base=\"b3c631c314c0bbca50c1b2843150fe33\" ... >"
177
+ ```
142
178
 
143
- *Rafael Mendonça França*
179
+ After:
144
180
 
145
- * Remove deprecated support for using the `HOST` environment variable to specify the server IP.
181
+ ```ruby
182
+ Rails.application.config.inspect
183
+ "#<Rails::Application::Configuration:0x00000001132b02a0>"
184
+ ```
146
185
 
147
- *Rafael Mendonça França*
186
+ *Petrik de Heus*
148
187
 
149
- * Remove deprecated `server` argument from the rails server command.
188
+ * Deprecate calling `Rails.application.secrets`.
150
189
 
151
- *Rafael Mendonça França*
190
+ Rails `secrets` have been deprecated in favor of `credentials`.
191
+ Calling `Rails.application.secrets` should show a deprecation warning.
152
192
 
153
- * Remove deprecated `SOURCE_ANNOTATION_DIRECTORIES` environment variable support from `rails notes`.
193
+ *Petrik de Heus*
154
194
 
155
- *Rafael Mendonça França*
195
+ * Store `secret_key_base` in `Rails.config` for local environments.
156
196
 
157
- * Remove deprecated `connection` option in the `rails dbconsole` command.
197
+ Rails `secrets` have been deprecated in favor of `credentials`.
198
+ For the local environments the `secret_key_base` is now stored in
199
+ `Rails.config.secret_key_base` instead of the soft deprecated
200
+ `Rails.application.secrets.secret_key_base`.
158
201
 
159
- *Rafael Mendonça França*
202
+ *Petrik de Heus*
160
203
 
161
- * Remove depreated `rake notes` tasks.
204
+ * Enable force_ssl=true in production by default: Force all access to the app over SSL,
205
+ use Strict-Transport-Security, and use secure cookies
162
206
 
163
- *Rafael Mendonça França*
207
+ *Justin Searls*, *Aaron Patterson*, *Guillermo Iguaran*, *Vinícius Bispo*
164
208
 
165
- * Return a 405 Method Not Allowed response when a request uses an unknown HTTP method.
209
+ * Add engine's draw paths to application route set, so that the application
210
+ can draw route files defined in engine paths.
166
211
 
167
- Fixes #38998.
212
+ *Gannon McGibbon*
168
213
 
169
- *Loren Norman*
214
+ * Support `VISUAL` environment variable for commands which open an editor,
215
+ and prefer it over `EDITOR`.
170
216
 
171
- * Make railsrc file location xdg-specification compliant
217
+ *Summer ☀️*
172
218
 
173
- `rails new` will now look for the default `railsrc` file at
174
- `$XDG_CONFIG_HOME/rails/railsrc` (or `~/.config/rails/railsrc` if
175
- `XDG_CONFIG_HOME` is not set). If this file does not exist, `rails new`
176
- will fall back to `~/.railsrc`.
219
+ * Add engine's `test/fixtures` path to `fixture_paths` in `on_load` hook if
220
+ path exists and is under the Rails application root.
177
221
 
178
- The fallback behaviour means this does not cause any breaking changes.
222
+ *Chris Salzberg*
179
223
 
180
- *Nick Wolf*
224
+ * `bin/rails app:template` now runs `bundle install` and any `after_bundle`
225
+ blocks after the template is executed.
181
226
 
182
- * Change the default logging level from :debug to :info to avoid inadvertent exposure of personally
183
- identifiable information (PII) in production environments.
227
+ *Jonathan Hefner* and *Gerry Caulfield*
184
228
 
185
- *Eric M. Payne*
229
+ * Enable passing column size to migration generator
186
230
 
187
- * Automatically generate abstract class when using multiple databases.
231
+ Previously you could pass a limit to the migration generator:
188
232
 
189
- 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.
233
+ `rails generate migration CreateAuthor name:text{65535}`
190
234
 
191
- Usage:
235
+ Now, a size attribute can be passed to the migration generator:
192
236
 
193
- ```bash
194
- $ bin/rails generate scaffold Pet name:string --database=animals
195
- ```
237
+ `rails generate migration CreateAuthor name:text{medium}`
196
238
 
197
- Will create an abstract class for the animals connection.
239
+ This generates a migration which includes the size attribute:
198
240
 
199
241
  ```ruby
200
- class AnimalsRecord < ApplicationRecord
201
- self.abstract_class = true
202
-
203
- connects_to database: { writing: :animals }
242
+ class CreateAuthor < ActiveRecord::Migration[7.1]
243
+ def change
244
+ create_table :authors do |t|
245
+ t.text :name, size: :medium
246
+ end
247
+ end
204
248
  end
205
249
  ```
206
250
 
207
- And generate a `Pet` model that inherits from the new `AnimalsRecord`:
251
+ *Josh Broughton*, *Hartley McGuire*
252
+
253
+ * Trying to set a config key with the same name of a method now raises:
208
254
 
209
255
  ```ruby
210
- class Pet < AnimalsRecord
211
- end
256
+ config.load_defaults = 7.0
257
+ # NoMethodError: Cannot assign to `load_defaults`, it is a configuration method
212
258
  ```
213
259
 
214
- 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.
260
+ *Xavier Noria*
261
+
262
+ * Deprecate `secrets:edit/show` and remove `secrets:setup`
263
+
264
+ `bin/rails secrets:setup` has been deprecated since Rails 5.2 in favor of
265
+ credentials. This command has been removed.
266
+
267
+ `bin/rails secrets:show` and `bin/rails secrets:edit` have been deprecated
268
+ in favor of credentials.
269
+
270
+ Run `bin/rails credentials:help` for more information
271
+
272
+ *Petrik de Heus*
273
+
274
+ * `bin/rails --help` will now list only framework and plugin commands. Rake
275
+ tasks defined in `lib/tasks/*.rake` files will no longer be included. For a
276
+ list of those tasks, use `rake -T`.
277
+
278
+ *Jonathan Hefner*
279
+
280
+ * Allow calling `bin/rails restart` outside of app directory.
281
+
282
+ The following would previously fail with a "No Rakefile found" error.
215
283
 
216
284
  ```bash
217
- $ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
285
+ $ blog/bin/rails restart
218
286
  ```
219
287
 
220
- This will ensure the model inherits from the `SecondaryBase` parent instead of `AnimalsRecord`
288
+ *Petrik de Heus*
289
+
290
+ * Support prerelease rubies in Gemfile template if RubyGems version is 3.3.13 or higher.
291
+
292
+ *Yasuo Honda*, *David Rodríguez*
293
+
294
+ * Autoloading setup honors root directories manually set by the user.
295
+
296
+ This is relevant for custom namespaces. For example, if you'd like classes
297
+ and modules under `app/services` to be defined in the `Services` namespace
298
+ without an extra `app/services/services` directory, this is now enough:
221
299
 
222
300
  ```ruby
223
- class Pet < SecondaryBase
224
- end
301
+ # config/initializers/autoloading.rb
302
+
303
+ # The namespace has to exist.
304
+ #
305
+ # In this example we define the module on the spot. Could also be created
306
+ # elsewhere and its definition loaded here with an ordinary `require`. In
307
+ # any case, `push_dir` expects a class or module object.
308
+ module Services; end
309
+
310
+ Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", namespace: Services)
225
311
  ```
226
312
 
227
- *Eileen M. Uchitelle*, *John Crepezzi*
313
+ Check the autoloading guide for further details.
314
+
315
+ *Xavier Noria*
316
+
317
+ * Railties now requires the irb gem as a dependency, which means when you install Rails, irb will also
318
+ be installed as a gem. Rails will then use the installed version of irb for its console instead of
319
+ relying on Ruby's built-in version.
320
+ This ensures that Rails has access to the most up-to-date and reliable version of irb for its console.
321
+
322
+ *Stan Lo*
323
+
324
+ * Use infinitive form for all rails command descriptions verbs.
325
+
326
+ *Petrik de Heus*
327
+
328
+ * Credentials commands (e.g. `bin/rails credentials:edit`) now respect
329
+ `config.credentials.content_path` and `config.credentials.key_path` when set
330
+ in `config/application.rb` or `config/environments/#{Rails.env}.rb`.
331
+
332
+ Before:
333
+
334
+ * `bin/rails credentials:edit` ignored `RAILS_ENV`, and would always edit
335
+ `config/credentials.yml.enc`.
336
+
337
+ * `bin/rails credentials:edit --environment foo` would create and edit
338
+ `config/credentials/foo.yml.enc`.
339
+
340
+ * If `config.credentials.content_path` or `config.credentials.key_path`
341
+ was set, `bin/rails credentials:edit` could not be used to edit the
342
+ credentials. Editing credentials required using `bin/rails
343
+ encrypted:edit path/to/credentials --key path/to/key`.
344
+
345
+ After:
346
+
347
+ * `bin/rails credentials:edit` will edit the credentials file that the app
348
+ would load for the current `RAILS_ENV`.
228
349
 
229
- * Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
350
+ * `bin/rails credentials:edit` respects `config.credentials.content_path`
351
+ and `config.credentials.key_path` when set in `config/application.rb`
352
+ or `config/environments/#{Rails.env}.rb`.
230
353
 
231
- *Chris Oliver*
354
+ * `bin/rails credentials:edit --environment foo` will create and edit
355
+ `config/credentials/foo.yml.enc` _if_ `config.credentials.content_path`
356
+ has not been set for the `foo` environment. Ultimately, it will edit
357
+ the credentials file that the app would load for the `foo` environment.
232
358
 
233
- * Create a new rails app using a minimal stack.
359
+ *Jonathan Hefner*
360
+
361
+ * Add descriptions for non-Rake commands when running `rails -h`.
234
362
 
235
- `rails new cool_app --minimal`
363
+ *Petrik de Heus*
236
364
 
237
- All the following are excluded from your minimal stack:
365
+ * Show relevant commands when calling help
238
366
 
239
- - action_cable
240
- - action_mailbox
241
- - action_mailer
242
- - action_text
243
- - active_job
244
- - active_storage
245
- - bootsnap
246
- - jbuilder
247
- - spring
248
- - system_tests
249
- - turbolinks
250
- - webpack
367
+ When running `rails -h` or just `rails` outside a Rails application,
368
+ Rails outputs all options for running the `rails new` command. This can be
369
+ confusing to users when they probably want to see the common Rails commands.
251
370
 
252
- *Haroon Ahmed*, *DHH*
371
+ Instead, we should always show the common commands when running `rails -h`
372
+ inside or outside a Rails application.
253
373
 
254
- * Add default ENV variable option with BACKTRACE to turn off backtrace cleaning when debugging framework code in the
255
- generated config/initializers/backtrace_silencers.rb.
374
+ As the relevant commands inside a Rails application differ from the
375
+ commands outside an application, the help USAGE file has been split to
376
+ show the most relevant commands for the context.
256
377
 
257
- `BACKTRACE=1 ./bin/rails runner "MyClass.perform"`
378
+ *Petrik de Heus*
379
+
380
+ * Add Rails::HealthController#show and map it to /up for newly generated applications.
381
+ Load balancers and uptime monitors all need a basic endpoint to tell whether the app is up.
382
+ This is a good starting point that'll work in many situations.
258
383
 
259
384
  *DHH*
260
385
 
261
- * The autoloading guide for Zeitwerk mode documents how to autoload classes
262
- during application boot in a safe way.
386
+ * Only use HostAuthorization middleware if `config.hosts` is not empty
263
387
 
264
- *Haroon Ahmed*, *Xavier Noria*
388
+ *Hartley McGuire*
265
389
 
266
- * The `classic` autoloader starts its deprecation cycle.
390
+ * Raise an exception when a `before_action`'s "only" or "except" filter
391
+ options reference an action that doesn't exist. This will be enabled by
392
+ default but can be overridden via config.
267
393
 
268
- 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.
394
+ ```ruby
395
+ # config/environments/production.rb
396
+ config.action_controller.raise_on_missing_callback_actions = false
397
+ ```
269
398
 
270
- *Xavier Noria*
399
+ *Jess Bees*
400
+
401
+ * Use physical processor count as the default Puma worker count in production.
402
+ This can be overridden by setting `ENV["WEB_CONCURRENCY"]` or editing the
403
+ generated "config/puma.rb" directly.
404
+
405
+ *DHH*
406
+
407
+ * Add Docker files by default to new apps: Dockerfile, .dockerignore, bin/docker-entrypoint.
408
+ These files can be skipped with `--skip-docker`. They're intended as a starting point for
409
+ a production deploy of the application. Not intended for development (see Docked Rails for that).
410
+
411
+ Example:
412
+
413
+ ```bash
414
+ $ docker build -t app .
415
+ $ docker volume create app-storage
416
+ $ docker run --rm -it -v app-storage:/rails/storage -p 3000:3000 --env RAILS_MASTER_KEY=<see config/master.key> app
417
+ ```
271
418
 
272
- * Adds `rails test:all` for running all tests in the test directory.
419
+ You can also start a console or a runner from this image:
273
420
 
274
- This runs all test files in the test directory, including system tests.
421
+ ```bash
422
+ $ docker run --rm -it -v app-storage:/rails/storage --env RAILS_MASTER_KEY=<see config/master.key> app console
423
+ ```
275
424
 
276
- *Niklas Häusele*
425
+ To create a multi-platform image on Apple Silicon to deploy on AMD or Intel and push to Docker Hub for user/app:
277
426
 
278
- * Add `config.generators.after_generate` for processing to generated files.
427
+ ```bash
428
+ $ docker login -u <user>
429
+ $ docker buildx create --use
430
+ $ docker buildx build --push --platform=linux/amd64,linux/arm64 -t <user/image> .
431
+ ```
279
432
 
280
- Register a callback that will get called right after generators has finished.
433
+ *DHH, Sam Ruby*
281
434
 
282
- *Yuji Yaginuma*
435
+ * Add ENV["SECRET_KEY_BASE_DUMMY"] for starting production environment with a generated secret base key,
436
+ which can be used to run tasks like `assets:precompile` without making the RAILS_MASTER_KEY available
437
+ to the build process.
283
438
 
284
- * Make test file patterns configurable via Environment variables
439
+ Dockerfile layer example:
285
440
 
286
- This makes test file patterns configurable via two environment variables:
287
- `DEFAULT_TEST`, to configure files to test, and `DEFAULT_TEST_EXCLUDE`,
288
- to configure files to exclude from testing.
441
+ ```
442
+ RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
443
+ ```
289
444
 
290
- These values were hardcoded before, which made it difficult to add
291
- new categories of tests that should not be executed by default (e.g:
292
- smoke tests).
445
+ *DHH*
293
446
 
294
- *Jorge Manrubia*
447
+ * Show descriptions for all commands in Rails help
295
448
 
296
- * No longer include `rake rdoc` task when generating plugins.
449
+ When calling `rails help` most commands missed their description. We now
450
+ show the same descriptions as shown in `rails -T`.
297
451
 
298
- To generate docs, use the `rdoc lib` command instead.
452
+ *Petrik de Heus*
299
453
 
300
- *Jonathan Hefner*
454
+ * Always generate the storage/ directory with rails new to ensure there's a stable place to
455
+ put permanent files, and a single mount point for containers to map. Then default sqlite3 databases
456
+ to live there instead of db/, which is only meant for configuration, not data.
457
+
458
+ *DHH*
301
459
 
302
- * Allow relative paths with trailing slashes to be passed to `rails test`.
460
+ * Rails console now disables `IRB`'s autocompletion feature in production by default.
303
461
 
304
- *Eugene Kenny*
462
+ Setting `IRB_USE_AUTOCOMPLETE=true` can override this default.
305
463
 
306
- * Add `rack-mini-profiler` gem to the default `Gemfile`.
464
+ *Stan Lo*
307
465
 
308
- `rack-mini-profiler` displays performance information such as SQL time and flame graphs.
309
- It's enabled by default in development environment, but can be enabled in production as well.
310
- See the gem [README](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md) for information on how to enable it in production.
466
+ * Add `config.precompile_filter_parameters`, which enables precompilation of
467
+ `config.filter_parameters` using `ActiveSupport::ParameterFilter.precompile_filters`.
468
+ Precompilation can improve filtering performance, depending on the quantity
469
+ and types of filters.
311
470
 
312
- *Osama Sayegh*
471
+ `config.precompile_filter_parameters` defaults to `true` for
472
+ `config.load_defaults 7.1` and above.
313
473
 
314
- * `rails stats` will now count TypeScript files toward JavaScript stats.
474
+ *Jonathan Hefner*
315
475
 
316
- *Joshua Cody*
476
+ * Add `after_routes_loaded` hook to `Rails::Railtie::Configuration` for
477
+ engines to add a hook to be called after application routes have been
478
+ loaded.
317
479
 
318
- * Run `git init` when generating plugins.
480
+ ```ruby
481
+ MyEngine.config.after_routes_loaded do
482
+ # code that must happen after routes have been loaded
483
+ end
484
+ ```
319
485
 
320
- Opt out with `--skip-git`.
486
+ *Chris Salzberg*
321
487
 
322
- *OKURA Masafumi*
488
+ * Send 303 See Other status code back for the destroy action on newly generated
489
+ scaffold controllers.
323
490
 
324
- * Add benchmark generator.
491
+ *Tony Drake*
325
492
 
326
- Introduce benchmark generator to benchmark Rails applications.
493
+ * Add `Rails.application.deprecators` as a central point to manage deprecators
494
+ for an application.
327
495
 
328
- `rails generate benchmark opt_compare`
496
+ Individual deprecators can be added and retrieved from the collection:
329
497
 
330
- This creates a benchmark file that uses [`benchmark-ips`](https://github.com/evanphx/benchmark-ips).
331
- By default, two code blocks can be benchmarked using the `before` and `after` reports.
498
+ ```ruby
499
+ Rails.application.deprecators[:my_gem] = ActiveSupport::Deprecation.new("2.0", "MyGem")
500
+ Rails.application.deprecators[:other_gem] = ActiveSupport::Deprecation.new("3.0", "OtherGem")
501
+ ```
332
502
 
333
- You can run the generated benchmark file using:
334
- `ruby script/benchmarks/opt_compare.rb`
503
+ And the collection's configuration methods affect all deprecators in the
504
+ collection:
335
505
 
336
- *Kevin Jalbert*, *Gannon McGibbon*
506
+ ```ruby
507
+ Rails.application.deprecators.debug = true
337
508
 
338
- * Cache compiled view templates when running tests by default.
509
+ Rails.application.deprecators[:my_gem].debug
510
+ # => true
511
+ Rails.application.deprecators[:other_gem].debug
512
+ # => true
513
+ ```
339
514
 
340
- When generating a new app without `--skip-spring`, caching classes is
341
- disabled in `environments/test.rb`. This implicitly disables caching
342
- view templates too. This change will enable view template caching by
343
- adding this to the generated `environments/test.rb`:
515
+ Additionally, all deprecators in the collection can be silenced for the
516
+ duration of a given block:
344
517
 
345
518
  ```ruby
346
- config.action_view.cache_template_loading = true
519
+ Rails.application.deprecators.silence do
520
+ Rails.application.deprecators[:my_gem].warn # => silenced (no warning)
521
+ Rails.application.deprecators[:other_gem].warn # => silenced (no warning)
522
+ end
347
523
  ```
348
524
 
349
- *Jorge Manrubia*
525
+ *Jonathan Hefner*
526
+
527
+ * Move dbconsole logic to Active Record connection adapter.
528
+
529
+ Instead of hosting the connection logic in the command object, the
530
+ database adapter should be responsible for connecting to a console session.
531
+ This patch moves #find_cmd_and_exec to the adapter and exposes a new API to
532
+ lookup the adapter class without instantiating it.
533
+
534
+ *Gannon McGibbon*, *Paarth Madan*
350
535
 
351
- * Introduce middleware move operations.
536
+ * Add `Rails.application.message_verifiers` as a central point to configure
537
+ and create message verifiers for an application.
352
538
 
353
- With this change, you no longer need to delete and reinsert a middleware to
354
- move it from one place to another in the stack:
539
+ This allows applications to, for example, rotate old `secret_key_base`
540
+ values:
355
541
 
356
542
  ```ruby
357
- config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
543
+ config.before_initialize do |app|
544
+ app.message_verifiers.rotate(secret_key_base: "old secret_key_base")
545
+ end
358
546
  ```
359
547
 
360
- This will move the `Magical::Unicorns` middleware before
361
- `ActionDispatch::Flash`. You can also move it after with:
548
+ And for libraries to create preconfigured message verifiers:
362
549
 
363
550
  ```ruby
364
- config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
551
+ ActiveStorage.verifier = Rails.application.message_verifiers["ActiveStorage"]
365
552
  ```
366
553
 
367
- *Genadi Samokovarov*
554
+ *Jonathan Hefner*
555
+
556
+ * Support MySQL's ssl-mode option for the dbconsole command.
368
557
 
369
- * Generators that inherit from NamedBase respect `--force` option.
558
+ Verifying the identity of the database server requires setting the ssl-mode
559
+ option to VERIFY_CA or VERIFY_IDENTITY. This option was previously ignored
560
+ for the dbconsole command.
370
561
 
371
- *Josh Brody*
562
+ *Petrik de Heus*
372
563
 
373
- * Allow configuration of eager_load behaviour for rake environment:
564
+ * Delegate application record generator description to orm hooked generator.
374
565
 
375
- config.rake_eager_load
566
+ *Gannon McGibbon*
376
567
 
377
- Defaults to `false` as per previous behaviour.
568
+ * Show BCC recipients when present in Action Mailer previews.
378
569
 
379
- *Thierry Joyal*
570
+ *Akshay Birajdar*
380
571
 
381
- * Ensure Rails migration generator respects system-wide primary key config.
572
+ * Extend `routes --grep` to also filter routes by matching against path.
382
573
 
383
- When rails is configured to use a specific primary key type:
574
+ Example:
575
+
576
+ ```bash
577
+ $ bin/rails routes --grep /cats/1
578
+ Prefix Verb URI Pattern Controller#Action
579
+ cat GET /cats/:id(.:format) cats#show
580
+ PATCH /cats/:id(.:format) cats#update
581
+ PUT /cats/:id(.:format) cats#update
582
+ DELETE /cats/:id(.:format) cats#destroy
583
+ ```
584
+
585
+ *Orhan Toy*
586
+
587
+ * Improve `rails runner` output when given a file path that doesn't exist.
588
+
589
+ *Tekin Suleyman*
590
+
591
+ * `config.allow_concurrency = false` now use a `Monitor` instead of a `Mutex`
592
+
593
+ This allows to enable `config.active_support.executor_around_test_case` even
594
+ when `config.allow_concurrency` is disabled.
595
+
596
+ *Jean Boussier*
597
+
598
+ * Add `routes --unused` option to detect extraneous routes.
599
+
600
+ Example:
601
+
602
+ ```bash
603
+ $ bin/rails routes --unused
604
+
605
+ Found 2 unused routes:
606
+
607
+ Prefix Verb URI Pattern Controller#Action
608
+ one GET /one(.:format) action#one
609
+ two GET /two(.:format) action#two
610
+ ```
611
+
612
+ *Gannon McGibbon*
613
+
614
+ * Add `--parent` option to controller generator to specify parent class of job.
615
+
616
+ Example:
617
+
618
+ `bin/rails g controller admin/users --parent=admin_controller` generates:
384
619
 
385
620
  ```ruby
386
- config.generators do |g|
387
- g.orm :active_record, primary_key_type: :uuid
621
+ class Admin::UsersController < AdminController
622
+ # ...
388
623
  end
389
624
  ```
390
625
 
391
- Previously:
626
+ *Gannon McGibbon*
627
+
628
+ * In-app custom credentials templates are now supported. When a credentials
629
+ file does not exist, `rails credentials:edit` will now try to use
630
+ `lib/templates/rails/credentials/credentials.yml.tt` to generate the
631
+ credentials file, before falling back to the default template.
632
+
633
+ This allows e.g. an open-source Rails app (which would not include encrypted
634
+ credentials files in its repo) to include a credentials template, so that
635
+ users who install the app will get a custom pre-filled credentials file when
636
+ they run `rails credentials:edit`.
637
+
638
+ *Jonathan Hefner*
639
+
640
+ * Except for `dev` and `test` environments, newly generated per-environment
641
+ credentials files (e.g. `config/credentials/production.yml.enc`) now include
642
+ a `secret_key_base` for convenience, just as `config/credentials.yml.enc`
643
+ does.
644
+
645
+ *Jonathan Hefner*
646
+
647
+ * `--no-*` options now work with the app generator's `--minimal` option, and
648
+ are both comprehensive and precise. For example:
392
649
 
393
650
  ```bash
394
- $ bin/rails g migration add_location_to_users location:references
651
+ $ rails new my_cool_app --minimal
652
+ Based on the specified options, the following options will also be activated:
653
+
654
+ --skip-active-job [due to --minimal]
655
+ --skip-action-mailer [due to --skip-active-job, --minimal]
656
+ --skip-active-storage [due to --skip-active-job, --minimal]
657
+ --skip-action-mailbox [due to --skip-active-storage, --minimal]
658
+ --skip-action-text [due to --skip-active-storage, --minimal]
659
+ --skip-javascript [due to --minimal]
660
+ --skip-hotwire [due to --skip-javascript, --minimal]
661
+ --skip-action-cable [due to --minimal]
662
+ --skip-bootsnap [due to --minimal]
663
+ --skip-dev-gems [due to --minimal]
664
+ --skip-system-test [due to --minimal]
665
+
666
+ ...
667
+
668
+ $ rails new my_cool_app --minimal --no-skip-active-storage
669
+ Based on the specified options, the following options will also be activated:
670
+
671
+ --skip-action-mailer [due to --minimal]
672
+ --skip-action-mailbox [due to --minimal]
673
+ --skip-action-text [due to --minimal]
674
+ --skip-javascript [due to --minimal]
675
+ --skip-hotwire [due to --skip-javascript, --minimal]
676
+ --skip-action-cable [due to --minimal]
677
+ --skip-bootsnap [due to --minimal]
678
+ --skip-dev-gems [due to --minimal]
679
+ --skip-system-test [due to --minimal]
680
+
681
+ ...
395
682
  ```
396
683
 
397
- The references line in the migration would not have `type: :uuid`.
398
- This change causes the type to be applied appropriately.
684
+ *Brad Trick* and *Jonathan Hefner*
399
685
 
400
- *Louis-Michel Couture*, *Dermot Haughey*
686
+ * Add `--skip-dev-gems` option to app generator to skip adding development
687
+ gems (like `web-console`) to the Gemfile.
401
688
 
402
- * Deprecate `Rails::DBConsole#config`.
689
+ *Brad Trick*
403
690
 
404
- `Rails::DBConsole#config` is deprecated without replacement. Use `Rails::DBConsole.db_config.configuration_hash` instead.
691
+ * Skip Active Storage and Action Mailer if Active Job is skipped.
405
692
 
406
- *Eileen M. Uchitelle*, *John Crepezzi*
693
+ *Étienne Barrié*
407
694
 
408
- * `Rails.application.config_for` merges shared configuration deeply.
695
+ * Correctly check if frameworks are disabled when running app:update.
409
696
 
410
- ```yaml
411
- # config/example.yml
412
- shared:
413
- foo:
414
- bar:
415
- baz: 1
416
- development:
417
- foo:
418
- bar:
419
- qux: 2
420
- ```
697
+ *Étienne Barrié* and *Paulo Barros*
698
+
699
+ * Delegate model generator description to orm hooked generator.
700
+
701
+ *Gannon McGibbon*
702
+
703
+ * Execute `rails runner` scripts inside the executor.
704
+
705
+ Enables error reporting, query cache, etc.
706
+
707
+ *Jean Boussier*
708
+
709
+ * Avoid booting in development then test for test tasks.
710
+
711
+ Running one of the rails test subtasks (e.g. test:system, test:models) would
712
+ go through Rake and cause the app to be booted twice. Now all the test:*
713
+ subtasks are defined as Thor tasks and directly load the test environment.
714
+
715
+ *Étienne Barrié*
716
+
717
+ * Deprecate `Rails::Generators::Testing::Behaviour` in favor of `Rails::Generators::Testing::Behavior`.
718
+
719
+ *Gannon McGibbon*
720
+
721
+ * Allow configuration of logger size for local and test environments
722
+
723
+ `config.log_file_size`
724
+
725
+ Defaults to `100` megabytes.
726
+
727
+ *Bernie Chiu*
728
+
729
+ * Enroll new apps in decrypted diffs of credentials by default. This behavior
730
+ can be opted out of with the app generator's `--skip-decrypted-diffs` flag.
731
+
732
+ *Jonathan Hefner*
733
+
734
+ * Support declarative-style test name filters with `bin/rails test`.
735
+
736
+ This makes it possible to run a declarative-style test such as:
421
737
 
422
738
  ```ruby
423
- # Previously
424
- Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 }
739
+ class MyTest < ActiveSupport::TestCase
740
+ test "does something" do
741
+ # ...
742
+ end
743
+ end
744
+ ```
745
+
746
+ Using its declared name:
425
747
 
426
- # Now
427
- Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
748
+ ```bash
749
+ $ bin/rails test test/my_test.rb -n "does something"
428
750
  ```
429
751
 
430
- *Yuhei Kiriyama*
752
+ Instead of having to specify its expanded method name:
753
+
754
+ ```bash
755
+ $ bin/rails test test/my_test.rb -n test_does_something
756
+ ```
757
+
758
+ *Jonathan Hefner*
759
+
760
+ * Add `--js` and `--skip-javascript` options to `rails new`
761
+
762
+ `--js` alias to `rails new --javascript ...`
763
+
764
+ Same as `-j`, e.g. `rails new --js esbuild ...`
431
765
 
432
- * Remove access to values in nested hashes returned by `Rails.application.config_for` via String keys.
766
+ `--skip-js` alias to `rails new --skip-javascript ...`
433
767
 
434
- ```yaml
435
- # config/example.yml
436
- development:
437
- options:
438
- key: value
768
+ Same as `-J`, e.g. `rails new --skip-js ...`
769
+
770
+ *Dorian Marié*
771
+
772
+ * Allow relative paths with leading dot slash to be passed to `rails test`.
773
+
774
+ Fix `rails test ./test/model/post_test.rb` to run a single test file.
775
+
776
+ *Shouichi Kamiya* and *oljfte*
777
+
778
+ * Deprecate `config.enable_dependency_loading`. This flag addressed a limitation of the `classic` autoloader and has no effect nowadays. To fix this deprecation, please just delete the reference.
779
+
780
+ *Xavier Noria*
781
+
782
+ * Define `config.enable_reloading` to be `!config.cache_classes` for a more intuitive name. While `config.enable_reloading` and `config.reloading_enabled?` are preferred from now on, `config.cache_classes` is supported for backwards compatibility.
783
+
784
+ *Xavier Noria*
785
+
786
+ * Add JavaScript dependencies installation on bin/setup
787
+
788
+ Add `yarn install` to bin/setup when using esbuild, webpack, or rollout.
789
+
790
+ *Carlos Ribeiro*
791
+
792
+ * Use `controller_class_path` in `Rails::Generators::NamedBase#route_url`
793
+
794
+ The `route_url` method now returns the correct path when generating
795
+ a namespaced controller with a top-level model using `--model-name`.
796
+
797
+ Previously, when running this command:
798
+
799
+ ```bash
800
+ $ bin/rails generate scaffold_controller Admin/Post --model-name Post
439
801
  ```
440
802
 
441
- ```ruby
442
- Rails.application.config_for(:example).options
803
+ the comments above the controller action would look like:
804
+
805
+ ``` ruby
806
+ # GET /posts
807
+ def index
808
+ @posts = Post.all
809
+ end
443
810
  ```
444
811
 
445
- 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.
812
+ afterwards, they now look like this:
446
813
 
447
- *Étienne Barrié*
814
+ ``` ruby
815
+ # GET /admin/posts
816
+ def index
817
+ @posts = Post.all
818
+ end
819
+ ```
448
820
 
449
- * Configuration files for environments (`config/environments/*.rb`) are
450
- now able to modify `autoload_paths`, `autoload_once_paths`, and
451
- `eager_load_paths`.
821
+ Fixes #44662.
452
822
 
453
- 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.
823
+ *Andrew White*
454
824
 
455
- Ways to use application code in these files:
825
+ * No longer add autoloaded paths to `$LOAD_PATH`.
456
826
 
457
- * 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.
827
+ This means it won't be possible to load them with a manual `require` call, the class or module can be referenced instead.
458
828
 
459
- ```ruby
460
- # In config/application.rb, for example.
461
- require "#{Rails.root}/lib/my_app/config"
829
+ Reducing the size of `$LOAD_PATH` speed-up `require` calls for apps not using `bootsnap`, and reduce the
830
+ size of the `bootsnap` cache for the others.
462
831
 
463
- # In config/environments/development.rb, for example.
464
- config.foo = MyApp::Config.foo
465
- ```
832
+ *Jean Boussier*
466
833
 
467
- * If the class has to be reloadable, then wrap the configuration code in a `to_prepare` block:
834
+ * Remove default `X-Download-Options` header
468
835
 
469
- ```ruby
470
- config.to_prepare do
471
- config.foo = MyModel.foo
472
- end
473
- ```
836
+ This header is currently only used by Internet Explorer which
837
+ will be discontinued in 2022 and since Rails 7 does not fully
838
+ support Internet Explorer this header should not be a default one.
474
839
 
475
- 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.
840
+ *Harun Sabljaković*
476
841
 
477
- *Allen Hsu* & *Xavier Noria*
842
+ * Add .node-version files for Rails apps that use Node.js
478
843
 
479
- * Support using environment variable to set pidfile.
844
+ Node version managers that make use of this file:
845
+ https://github.com/shadowspawn/node-version-usage#node-version-file-usage
480
846
 
481
- *Ben Thorner*
847
+ The generated Dockerfile will use the same node version.
482
848
 
849
+ *Sam Ruby*
483
850
 
484
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/railties/CHANGELOG.md) for previous changes.
851
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/railties/CHANGELOG.md) for previous changes.