railties 6.0.0 → 7.1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +699 -245
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.md +99 -0
  5. data/README.rdoc +7 -8
  6. data/lib/minitest/rails_plugin.rb +80 -2
  7. data/lib/rails/all.rb +0 -1
  8. data/lib/rails/api/task.rb +37 -5
  9. data/lib/rails/app_updater.rb +9 -6
  10. data/lib/rails/application/bootstrap.rb +52 -14
  11. data/lib/rails/application/configuration.rb +327 -86
  12. data/lib/rails/application/default_middleware_stack.rb +33 -7
  13. data/lib/rails/application/dummy_config.rb +19 -0
  14. data/lib/rails/application/finisher.rb +94 -113
  15. data/lib/rails/application/routes_reloader.rb +17 -3
  16. data/lib/rails/application.rb +258 -201
  17. data/lib/rails/application_controller.rb +3 -4
  18. data/lib/rails/autoloaders/inflector.rb +21 -0
  19. data/lib/rails/autoloaders.rb +42 -42
  20. data/lib/rails/backtrace_cleaner.rb +13 -8
  21. data/lib/rails/cli.rb +5 -2
  22. data/lib/rails/code_statistics.rb +6 -4
  23. data/lib/rails/code_statistics_calculator.rb +16 -7
  24. data/lib/rails/command/actions.rb +10 -12
  25. data/lib/rails/command/base.rb +66 -46
  26. data/lib/rails/command/behavior.rb +3 -3
  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 -32
  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 +54 -39
  34. data/lib/rails/commands/credentials/credentials_command/diffing.rb +53 -0
  35. data/lib/rails/commands/credentials/credentials_command.rb +83 -60
  36. data/lib/rails/commands/db/system/change/change_command.rb +8 -2
  37. data/lib/rails/commands/dbconsole/dbconsole_command.rb +39 -124
  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 +3 -3
  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 +5 -14
  51. data/lib/rails/commands/plugin/plugin_command.rb +2 -0
  52. data/lib/rails/commands/rake/rake_command.rb +27 -23
  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 -43
  59. data/lib/rails/commands/secrets/secrets_command.rb +20 -38
  60. data/lib/rails/commands/server/server_command.rb +40 -64
  61. data/lib/rails/commands/test/USAGE +14 -0
  62. data/lib/rails/commands/test/test_command.rb +58 -16
  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 +53 -23
  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 +54 -9
  70. data/lib/rails/engine/updater.rb +1 -1
  71. data/lib/rails/engine.rb +105 -81
  72. data/lib/rails/gem_version.rb +5 -5
  73. data/lib/rails/generators/actions/create_migration.rb +9 -5
  74. data/lib/rails/generators/actions.rb +275 -97
  75. data/lib/rails/generators/active_model.rb +28 -14
  76. data/lib/rails/generators/app_base.rb +487 -165
  77. data/lib/rails/generators/app_name.rb +3 -14
  78. data/lib/rails/generators/base.rb +42 -31
  79. data/lib/rails/generators/database.rb +41 -4
  80. data/lib/rails/generators/erb/mailer/mailer_generator.rb +0 -1
  81. data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
  82. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -1
  83. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +11 -11
  84. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
  85. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
  86. data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
  87. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
  88. data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
  89. data/lib/rails/generators/erb.rb +1 -2
  90. data/lib/rails/generators/generated_attribute.rb +60 -19
  91. data/lib/rails/generators/migration.rb +4 -8
  92. data/lib/rails/generators/model_helpers.rb +29 -4
  93. data/lib/rails/generators/named_base.rb +15 -15
  94. data/lib/rails/generators/rails/app/USAGE +23 -6
  95. data/lib/rails/generators/rails/app/app_generator.rb +151 -80
  96. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +103 -0
  97. data/lib/rails/generators/rails/app/templates/Gemfile.tt +44 -54
  98. data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
  99. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
  100. data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
  101. data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
  102. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +4 -9
  103. data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
  104. data/lib/rails/generators/rails/app/templates/bin/rails.tt +3 -3
  105. data/lib/rails/generators/rails/app/templates/bin/rake.tt +2 -2
  106. data/lib/rails/generators/rails/app/templates/bin/setup.tt +19 -15
  107. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +18 -23
  108. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +3 -3
  109. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +5 -6
  110. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
  111. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +17 -16
  112. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +5 -5
  113. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +12 -11
  114. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
  115. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +17 -18
  116. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +4 -4
  117. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +14 -13
  118. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
  119. data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
  120. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +32 -14
  121. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +42 -55
  122. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +27 -15
  123. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +3 -5
  124. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +21 -28
  125. data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +3 -3
  126. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +6 -2
  127. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
  128. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +284 -0
  129. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +13 -0
  130. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +13 -15
  131. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +17 -20
  132. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +8 -1
  133. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
  134. data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
  135. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -5
  136. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
  137. data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
  138. data/lib/rails/generators/rails/app/templates/gitattributes.tt +9 -0
  139. data/lib/rails/generators/rails/app/templates/gitignore.tt +12 -9
  140. data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
  141. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
  142. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +13 -11
  143. data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
  144. data/lib/rails/generators/rails/benchmark/USAGE +19 -0
  145. data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +30 -0
  146. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
  147. data/lib/rails/generators/rails/controller/USAGE +13 -5
  148. data/lib/rails/generators/rails/controller/controller_generator.rb +7 -42
  149. data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -5
  150. data/lib/rails/generators/rails/credentials/credentials_generator.rb +30 -25
  151. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
  152. data/lib/rails/generators/rails/db/system/change/change_generator.rb +31 -1
  153. data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +6 -2
  154. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
  155. data/lib/rails/generators/rails/generator/USAGE +2 -2
  156. data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
  157. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
  158. data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
  159. data/lib/rails/generators/rails/helper/USAGE +2 -3
  160. data/lib/rails/generators/rails/integration_test/USAGE +2 -2
  161. data/lib/rails/generators/rails/migration/USAGE +22 -12
  162. data/lib/rails/generators/rails/model/model_generator.rb +4 -0
  163. data/lib/rails/generators/rails/plugin/USAGE +17 -6
  164. data/lib/rails/generators/rails/plugin/plugin_generator.rb +86 -46
  165. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +15 -20
  166. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +10 -39
  167. data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
  168. data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
  169. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
  170. data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
  171. data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
  172. data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
  173. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +7 -22
  174. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +10 -14
  175. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
  176. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
  177. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
  178. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +3 -3
  179. data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
  180. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
  181. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +6 -14
  182. data/lib/rails/generators/rails/resource/USAGE +4 -4
  183. data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
  184. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
  185. data/lib/rails/generators/rails/scaffold/USAGE +5 -5
  186. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -20
  187. data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
  188. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +7 -2
  189. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -6
  190. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +7 -11
  191. data/lib/rails/generators/rails/system_test/USAGE +2 -2
  192. data/lib/rails/generators/rails/task/USAGE +3 -3
  193. data/lib/rails/generators/resource_helpers.rb +2 -2
  194. data/lib/rails/generators/test_case.rb +3 -3
  195. data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
  196. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
  197. data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
  198. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +3 -3
  199. data/lib/rails/generators/test_unit/integration/integration_generator.rb +0 -1
  200. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
  201. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
  202. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
  203. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
  204. data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
  205. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
  206. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
  207. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -5
  208. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +6 -6
  209. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +8 -8
  210. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
  211. data/lib/rails/generators/testing/assertions.rb +2 -2
  212. data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +8 -7
  213. data/lib/rails/generators.rb +43 -45
  214. data/lib/rails/health_controller.rb +55 -0
  215. data/lib/rails/info.rb +4 -4
  216. data/lib/rails/info_controller.rb +30 -13
  217. data/lib/rails/initializable.rb +1 -1
  218. data/lib/rails/mailers_controller.rb +18 -9
  219. data/lib/rails/paths.rb +28 -19
  220. data/lib/rails/rack/logger.rb +17 -17
  221. data/lib/rails/rackup/server.rb +15 -0
  222. data/lib/rails/railtie/configurable.rb +0 -1
  223. data/lib/rails/railtie/configuration.rb +15 -3
  224. data/lib/rails/railtie.rb +80 -37
  225. data/lib/rails/ruby_version_check.rb +5 -3
  226. data/lib/rails/secrets.rb +14 -9
  227. data/lib/rails/source_annotation_extractor.rb +69 -34
  228. data/lib/rails/tasks/engine.rake +8 -11
  229. data/lib/rails/tasks/framework.rake +4 -6
  230. data/lib/rails/tasks/log.rake +1 -1
  231. data/lib/rails/tasks/misc.rake +4 -15
  232. data/lib/rails/tasks/statistics.rake +9 -6
  233. data/lib/rails/tasks/tmp.rake +13 -6
  234. data/lib/rails/tasks/yarn.rake +17 -6
  235. data/lib/rails/tasks/zeitwerk.rake +16 -41
  236. data/lib/rails/tasks.rb +0 -6
  237. data/lib/rails/templates/layouts/application.html.erb +15 -0
  238. data/lib/rails/templates/rails/mailers/email.html.erb +46 -11
  239. data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
  240. data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
  241. data/lib/rails/templates/rails/welcome/index.html.erb +65 -48
  242. data/lib/rails/test_help.rb +13 -14
  243. data/lib/rails/test_unit/line_filtering.rb +1 -1
  244. data/lib/rails/test_unit/railtie.rb +0 -4
  245. data/lib/rails/test_unit/reporter.rb +8 -3
  246. data/lib/rails/test_unit/runner.rb +61 -19
  247. data/lib/rails/test_unit/test_parser.rb +88 -0
  248. data/lib/rails/test_unit/testing.rake +17 -36
  249. data/lib/rails/testing/maintain_test_schema.rb +16 -0
  250. data/lib/rails/version.rb +1 -1
  251. data/lib/rails/welcome_controller.rb +1 -0
  252. data/lib/rails/zeitwerk_checker.rb +15 -0
  253. data/lib/rails.rb +31 -23
  254. metadata +89 -58
  255. data/RDOC_MAIN.rdoc +0 -98
  256. data/lib/rails/application/dummy_erb_compiler.rb +0 -18
  257. data/lib/rails/command/spellchecker.rb +0 -58
  258. data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
  259. data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
  260. data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
  261. data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
  262. data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
  263. data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
  264. data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -10
  265. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
  266. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
  267. data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
  268. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -7
  269. data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
  270. data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
  271. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
  272. data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
  273. data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
  274. data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
  275. data/lib/rails/generators/rails/assets/USAGE +0 -17
  276. data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
  277. data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
  278. data/lib/rails/generators/rails/model/USAGE +0 -114
  279. data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
  280. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
  281. data/lib/rails/tasks/annotations.rake +0 -22
  282. data/lib/rails/tasks/dev.rake +0 -11
  283. data/lib/rails/tasks/initializers.rake +0 -9
  284. data/lib/rails/tasks/middleware.rake +0 -9
  285. data/lib/rails/tasks/restart.rake +0 -9
  286. data/lib/rails/tasks/routes.rake +0 -9
data/CHANGELOG.md CHANGED
@@ -1,429 +1,883 @@
1
- ## Rails 6.0.0 (August 16, 2019) ##
1
+ ## Rails 7.1.3.2 (February 21, 2024) ##
2
2
 
3
- * `Rails.autoloaders.log!` is a logging shortcut to get the activity of the
4
- loaders printed to standard output. May be handy for troubleshooting.
3
+ * No changes.
5
4
 
6
- *Xavier Noria*
7
5
 
6
+ ## Rails 7.1.3.1 (February 21, 2024) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 7.1.3 (January 16, 2024) ##
12
+
13
+ * Make sure `config.after_routes_loaded` hook runs on boot.
14
+
15
+ *Rafael Mendonça França*
16
+
17
+ * Fix `config.log_level` not being respected when using a `BroadcastLogger`
18
+
19
+ *Édouard Chin*
20
+
21
+ * Fix isolated engines to take `ActiveRecord::Base.table_name_prefix` into consideration.
22
+ This will allow for engine defined models, such as inside Active Storage, to respect
23
+ Active Record table name prefix configuration.
24
+
25
+ *Chedli Bourguiba*
26
+
27
+ * The `bin/rails app:template` command will no longer add potentially unwanted
28
+ gem platforms via `bundle lock --add-platform=...` commands.
8
29
 
9
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
30
+ *Jonathan Hefner*
10
31
 
11
- * The new configuration point `config.add_autoload_paths_to_load_path` allows
12
- users to opt-out from adding autoload paths to `$LOAD_PATH`. This flag is
13
- `true` by default, but it is recommended to be set to `false` in `:zeitwerk`
14
- mode early, in `config/application.rb`.
15
32
 
16
- Zeitwerk uses only absolute paths internally, and applications running in
17
- `:zeitwerk` mode do not need `require_dependency`, so models, controllers,
18
- jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves
19
- Ruby from checking these directories when resolving `require` calls with
20
- relative paths, and saves Bootsnap work and RAM, since it does not need to
21
- build an index for them.
33
+ ## Rails 7.1.2 (November 10, 2023) ##
34
+
35
+ * Fix running `db:system:change` when app has no Dockerfile.
36
+
37
+ *Hartley McGuire*
38
+
39
+ * If you accessed `config.eager_load_paths` and friends, later changes to
40
+ `config.paths` were not reflected in the expected auto/eager load paths.
41
+ Now, they are.
42
+
43
+ This bug has been latent since Rails 3.
44
+
45
+ Fixes #49629.
22
46
 
23
47
  *Xavier Noria*
24
48
 
25
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
49
+ ## Rails 7.1.1 (October 11, 2023) ##
50
+
51
+ * Ensures the Rails generated Dockerfile uses correct ruby version and matches Gemfile.
52
+
53
+ *Abhay Nikam*
54
+
55
+
56
+ ## Rails 7.1.0 (October 05, 2023) ##
57
+
58
+ * No changes.
59
+
60
+
61
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
26
62
 
27
- * Applications upgrading to Rails 6 can run the command
63
+ * Always set the Rails logger to be an instance of `ActiveSupport::BroadcastLogger`.
28
64
 
65
+ *Edouard Chin*
66
+
67
+
68
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
69
+
70
+ * Require `concurrent-ruby` in `config/puma.rb` so that Puma can boot in
71
+ production when `WEB_CONCURRENCY` is not explicitly specified.
72
+
73
+ Fixes #49323.
74
+
75
+ *Matt Brictson*
76
+
77
+ * Raise error when generating attribute with dangerous name.
78
+
79
+ The following will now raise an error as `save` and `hash` are already
80
+ defined by Active Record.
81
+
82
+ ```bash
83
+ $ bin/rails generate model Post save
84
+ $ bin/rails generate model Post hash
29
85
  ```
30
- bin/rails zeitwerk:check
86
+
87
+ *Petrik de Heus*
88
+
89
+
90
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
91
+
92
+ * Add ability to show slow tests to the test runner
93
+
94
+ ```bash
95
+ $ bin/test --profile # additionally prints 10 (default) slowest tests
96
+ # or
97
+ $ bin/test --profile 20 # prints 20 slowest tests
31
98
  ```
32
99
 
33
- to check if the project structure they were using with the classic
34
- autoloader is compatible with `:zeitwerk` mode.
100
+ *fatkodima*
101
+
102
+ * `rails new --javascript` generator now supports Bun
35
103
 
36
- *Matilda Smeds* & *Xavier Noria*
104
+ ```bash
105
+ $ rails new my_new_app --javascript=bun
106
+ ```
37
107
 
38
- * Allow loading seeds without ActiveJob.
108
+ *Jason Meller*
39
109
 
40
- Fixes #35782
110
+ * bin/setup uses `bun` instead of `yarn` when generated an app with bun
41
111
 
42
- *Jeremy Weathers*
112
+ Use `bun install` on `bin/setup` when using `bun`.
43
113
 
44
- * `null: false` is set in the migrations by default for column pointed by
45
- `belongs_to` / `references` association generated by model generator.
114
+ *Cadu Ribeiro*
46
115
 
47
- Also deprecate passing {required} to the model generator.
116
+ * `config/application.rb` now includes
48
117
 
49
- *Prathamesh Sonpatki*
118
+ ```ruby
119
+ config.autoload_lib(ignore: %w(assets tasks))
120
+ ```
50
121
 
51
- * New applications get `config.cache_classes = false` in `config/environments/test.rb`
52
- unless `--skip-spring`.
122
+ In practice, this means that new 7.1 applications autoload from `lib` out of the box.
53
123
 
54
124
  *Xavier Noria*
55
125
 
56
- * Autoloading during initialization is deprecated.
126
+ * Add an option to start rails console in sandbox mode by default
57
127
 
58
- *Xavier Noria*
128
+ `sandbox_by_default` option is added to start rails console in sandbox
129
+ mode by default. With this option turned on, `--no-sandbox` must be
130
+ specified to start rails in non-sandbox mode.
131
+
132
+ Note that this option is ignored when rails environment is development
133
+ or test.
59
134
 
60
- * Only force `:async` ActiveJob adapter to `:inline` during seeding.
135
+ *Shouichi Kamiya*
136
+
137
+ * Omit `webdrivers` gem dependency from `Gemfile` template
138
+
139
+ *Sean Doyle*
140
+
141
+ * Support filtering tests by line ranges
142
+
143
+ The new syntax allows you to filter tests by line ranges. For example, the
144
+ following command runs tests from line 10 to 20.
145
+
146
+ ```bash
147
+ $ rails test test/models/user_test.rb:10-20
148
+ ```
61
149
 
62
- *BatedUrGonnaDie*
150
+ *Shouichi Kamiya*, *Seonggi Yang*, *oljfte*, *Ryohei UEDA*
63
151
 
64
- * The `connection` option of `rails dbconsole` command is deprecated in
65
- favor of `database` option.
152
+ * Update default scaffold templates to set 303 (See Other) as status code
153
+ on redirect for the update action for XHR requests other than GET or POST
154
+ to avoid issues (e.g browsers trying to follow the redirect using the
155
+ original request method resulting in double PATCH/PUT)
66
156
 
67
- *Yuji Yaginuma*
157
+ *Guillermo Iguaran*
68
158
 
69
- * Replace `chromedriver-helper` gem with `webdrivers` in default Gemfile.
70
- `chromedriver-helper` is deprecated as of March 31, 2019 and won't
71
- receive any further updates.
159
+ * The new `config.autoload_lib_once` is similar to `config.autoload_lib`,
160
+ except that it adds `lib` to `config.autoload_once_paths` instead.
72
161
 
73
- *Guillermo Iguaran‮*
162
+ By calling `config.autoload_lib_once`, classes and modules in `lib` can be
163
+ autoloaded, even from application initializers, but won't be reloaded.
74
164
 
75
- * Applications running in `:zeitwerk` mode that use `bootsnap` need
76
- to upgrade `bootsnap` to at least 1.4.2.
165
+ Please, see further details in the [autoloading
166
+ guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
77
167
 
78
168
  *Xavier Noria*
79
169
 
80
- * Add `config.disable_sandbox` option to Rails console.
170
+ * Add `config.action_dispatch.debug_exception_log_level` to configure the log
171
+ level used by `ActionDispatch::DebugExceptions`.
81
172
 
82
- This setting will disable `rails console --sandbox` mode, preventing
83
- developer from accidentally starting a sandbox console,
84
- which when left inactive, can cause the database server to run out of memory.
173
+ The default is `:fatal`, but with `load_defaults "7.1"` the default will be
174
+ `:error`.
85
175
 
86
- *Prem Sichanugrist*
176
+ *Hartley McGuire*
87
177
 
88
- * Add `-e/--environment` option to `rails initializers`.
178
+ * Add `DATABASE` option to `railties:install:migrations`
89
179
 
90
- *Yuji Yaginuma*
180
+ This allows you to specify which database the migrations should be copied to
181
+ when running `rails railties:install:migrations`.
91
182
 
183
+ ```bash
184
+ $ rails railties:install:migrations DATABASE=animals
185
+ ```
186
+
187
+ *Matthew Hirst*
188
+
189
+ * The new method `config.autoload_lib(ignore:)` provides a simple way to
190
+ autoload from `lib`:
191
+
192
+ ```ruby
193
+ # config/application.rb
194
+ config.autoload_lib(ignore: %w(assets tasks))
195
+ ```
196
+
197
+ Please, see further details in the [autoloading
198
+ guide](https://guides.rubyonrails.org/v7.1/autoloading_and_reloading_constants.html).
199
+
200
+ *Xavier Noria*
201
+
202
+ * Don't show secret_key_base for `Rails.application.config#inspect`.
203
+
204
+ Before:
205
+
206
+ ```ruby
207
+ Rails.application.config.inspect
208
+ "#<Rails::Application::Configuration:0x00000001132b02a0 @root=... @secret_key_base=\"b3c631c314c0bbca50c1b2843150fe33\" ... >"
209
+ ```
92
210
 
93
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
211
+ After:
94
212
 
95
- * Generate random development secrets
213
+ ```ruby
214
+ Rails.application.config.inspect
215
+ "#<Rails::Application::Configuration:0x00000001132b02a0>"
216
+ ```
217
+
218
+ *Petrik de Heus*
96
219
 
97
- A random development secret is now generated to tmp/development_secret.txt
220
+ * Deprecate calling `Rails.application.secrets`.
98
221
 
99
- This avoids an issue where development mode servers were vulnerable to
100
- remote code execution.
222
+ Rails `secrets` have been deprecated in favor of `credentials`.
223
+ Calling `Rails.application.secrets` should show a deprecation warning.
101
224
 
102
- Fixes CVE-2019-5420
225
+ *Petrik de Heus*
103
226
 
104
- *Eileen M. Uchitelle*, *Aaron Patterson*, *John Hawthorn*
227
+ * Store `secret_key_base` in `Rails.config` for local environments.
105
228
 
229
+ Rails `secrets` have been deprecated in favor of `credentials`.
230
+ For the local environments the `secret_key_base` is now stored in
231
+ `Rails.config.secret_key_base` instead of the soft deprecated
232
+ `Rails.application.secrets.secret_key_base`.
106
233
 
107
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
234
+ *Petrik de Heus*
108
235
 
109
- * Fix non-symbol access to nested hashes returned from `Rails::Application.config_for`
110
- being broken by allowing non-symbol access with a deprecation notice.
236
+ * Enable force_ssl=true in production by default: Force all access to the app over SSL,
237
+ use Strict-Transport-Security, and use secure cookies
111
238
 
112
- *Ufuk Kayserilioglu*
239
+ *Justin Searls*, *Aaron Patterson*, *Guillermo Iguaran*, *Vinícius Bispo*
113
240
 
114
- * Fix deeply nested namespace command printing.
241
+ * Add engine's draw paths to application route set, so that the application
242
+ can draw route files defined in engine paths.
115
243
 
116
244
  *Gannon McGibbon*
117
245
 
246
+ * Support `VISUAL` environment variable for commands which open an editor,
247
+ and prefer it over `EDITOR`.
118
248
 
119
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
249
+ *Summer ☀️*
120
250
 
121
- * Remove deprecated `after_bundle` helper inside plugins templates.
251
+ * Add engine's `test/fixtures` path to `fixture_paths` in `on_load` hook if
252
+ path exists and is under the Rails application root.
122
253
 
123
- *Rafael Mendonça França*
254
+ *Chris Salzberg*
124
255
 
125
- * Remove deprecated support to old `config.ru` that use the application class as argument of `run`.
256
+ * `bin/rails app:template` now runs `bundle install` and any `after_bundle`
257
+ blocks after the template is executed.
126
258
 
127
- *Rafael Mendonça França*
259
+ *Jonathan Hefner* and *Gerry Caulfield*
128
260
 
129
- * Remove deprecated `environment` argument from the rails commands.
261
+ * Enable passing column size to migration generator
130
262
 
131
- *Rafael Mendonça França*
263
+ Previously you could pass a limit to the migration generator:
132
264
 
133
- * Remove deprecated `capify!`.
265
+ `rails generate migration CreateAuthor name:text{65535}`
134
266
 
135
- *Rafael Mendonça França*
267
+ Now, a size attribute can be passed to the migration generator:
136
268
 
137
- * Remove deprecated `config.secret_token`.
269
+ `rails generate migration CreateAuthor name:text{medium}`
138
270
 
139
- *Rafael Mendonça França*
271
+ This generates a migration which includes the size attribute:
140
272
 
141
- * Seed database with inline ActiveJob job adapter.
273
+ ```ruby
274
+ class CreateAuthor < ActiveRecord::Migration[7.1]
275
+ def change
276
+ create_table :authors do |t|
277
+ t.text :name, size: :medium
278
+ end
279
+ end
280
+ end
281
+ ```
142
282
 
143
- *Gannon McGibbon*
283
+ *Josh Broughton*, *Hartley McGuire*
144
284
 
145
- * Add `rails db:system:change` command for changing databases.
285
+ * Trying to set a config key with the same name of a method now raises:
146
286
 
287
+ ```ruby
288
+ config.load_defaults = 7.0
289
+ # NoMethodError: Cannot assign to `load_defaults`, it is a configuration method
147
290
  ```
148
- bin/rails db:system:change --to=postgresql
149
- force config/database.yml
150
- gsub Gemfile
291
+
292
+ *Xavier Noria*
293
+
294
+ * Deprecate `secrets:edit/show` and remove `secrets:setup`
295
+
296
+ `bin/rails secrets:setup` has been deprecated since Rails 5.2 in favor of
297
+ credentials. This command has been removed.
298
+
299
+ `bin/rails secrets:show` and `bin/rails secrets:edit` have been deprecated
300
+ in favor of credentials.
301
+
302
+ Run `bin/rails credentials:help` for more information
303
+
304
+ *Petrik de Heus*
305
+
306
+ * `bin/rails --help` will now list only framework and plugin commands. Rake
307
+ tasks defined in `lib/tasks/*.rake` files will no longer be included. For a
308
+ list of those tasks, use `rake -T`.
309
+
310
+ *Jonathan Hefner*
311
+
312
+ * Allow calling `bin/rails restart` outside of app directory.
313
+
314
+ The following would previously fail with a "No Rakefile found" error.
315
+
316
+ ```bash
317
+ $ blog/bin/rails restart
151
318
  ```
152
319
 
153
- The change command copies a template `config/database.yml` with
154
- the target database adapter into your app, and replaces your database gem
155
- with the target database gem.
320
+ *Petrik de Heus*
156
321
 
157
- *Gannon McGibbon*
322
+ * Support prerelease rubies in Gemfile template if RubyGems version is 3.3.13 or higher.
158
323
 
159
- * Add `rails test:channels`.
324
+ *Yasuo Honda*, *David Rodríguez*
160
325
 
161
- *bogdanvlviv*
326
+ * Autoloading setup honors root directories manually set by the user.
162
327
 
163
- * Use original `bundler` environment variables during the process of generating a new rails project.
328
+ This is relevant for custom namespaces. For example, if you'd like classes
329
+ and modules under `app/services` to be defined in the `Services` namespace
330
+ without an extra `app/services/services` directory, this is now enough:
164
331
 
165
- *Marco Costa*
332
+ ```ruby
333
+ # config/initializers/autoloading.rb
166
334
 
167
- * Send Active Storage analysis and purge jobs to dedicated queues by default.
335
+ # The namespace has to exist.
336
+ #
337
+ # In this example we define the module on the spot. Could also be created
338
+ # elsewhere and its definition loaded here with an ordinary `require`. In
339
+ # any case, `push_dir` expects a class or module object.
340
+ module Services; end
168
341
 
169
- Analysis jobs now use the `:active_storage_analysis` queue, and purge jobs
170
- now use the `:active_storage_purge` queue. This matches Action Mailbox,
171
- which sends its jobs to dedicated queues by default.
342
+ Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", namespace: Services)
343
+ ```
172
344
 
173
- *George Claghorn*
345
+ Check the autoloading guide for further details.
174
346
 
175
- * Add `rails test:mailboxes`.
347
+ *Xavier Noria*
176
348
 
177
- *George Claghorn*
349
+ * Railties now requires the irb gem as a dependency, which means when you install Rails, irb will also
350
+ be installed as a gem. Rails will then use the installed version of irb for its console instead of
351
+ relying on Ruby's built-in version.
352
+ This ensures that Rails has access to the most up-to-date and reliable version of irb for its console.
178
353
 
179
- * Introduce guard against DNS rebinding attacks.
354
+ *Stan Lo*
180
355
 
181
- The `ActionDispatch::HostAuthorization` is a new middleware that prevents
182
- against DNS rebinding and other `Host` header attacks. It is included in
183
- the development environment by default with the following configuration:
356
+ * Use infinitive form for all rails command descriptions verbs.
184
357
 
185
- Rails.application.config.hosts = [
186
- IPAddr.new("0.0.0.0/0"), # All IPv4 addresses.
187
- IPAddr.new("::/0"), # All IPv6 addresses.
188
- "localhost" # The localhost reserved domain.
189
- ]
358
+ *Petrik de Heus*
190
359
 
191
- In other environments `Rails.application.config.hosts` is empty and no
192
- `Host` header checks will be done. If you want to guard against header
193
- attacks on production, you have to manually permit the allowed hosts
194
- with:
360
+ * Credentials commands (e.g. `bin/rails credentials:edit`) now respect
361
+ `config.credentials.content_path` and `config.credentials.key_path` when set
362
+ in `config/application.rb` or `config/environments/#{Rails.env}.rb`.
195
363
 
196
- Rails.application.config.hosts << "product.com"
364
+ Before:
197
365
 
198
- The host of a request is checked against the `hosts` entries with the case
199
- operator (`#===`), which lets `hosts` support entries of type `Regexp`,
200
- `Proc` and `IPAddr` to name a few. Here is an example with a regexp.
366
+ * `bin/rails credentials:edit` ignored `RAILS_ENV`, and would always edit
367
+ `config/credentials.yml.enc`.
201
368
 
202
- # Allow requests from subdomains like `www.product.com` and
203
- # `beta1.product.com`.
204
- Rails.application.config.hosts << /.*\.product\.com/
369
+ * `bin/rails credentials:edit --environment foo` would create and edit
370
+ `config/credentials/foo.yml.enc`.
205
371
 
206
- A special case is supported that allows you to permit all sub-domains:
372
+ * If `config.credentials.content_path` or `config.credentials.key_path`
373
+ was set, `bin/rails credentials:edit` could not be used to edit the
374
+ credentials. Editing credentials required using `bin/rails
375
+ encrypted:edit path/to/credentials --key path/to/key`.
207
376
 
208
- # Allow requests from subdomains like `www.product.com` and
209
- # `beta1.product.com`.
210
- Rails.application.config.hosts << ".product.com"
377
+ After:
211
378
 
212
- *Genadi Samokovarov*
379
+ * `bin/rails credentials:edit` will edit the credentials file that the app
380
+ would load for the current `RAILS_ENV`.
213
381
 
214
- * Remove redundant suffixes on generated helpers.
382
+ * `bin/rails credentials:edit` respects `config.credentials.content_path`
383
+ and `config.credentials.key_path` when set in `config/application.rb`
384
+ or `config/environments/#{Rails.env}.rb`.
215
385
 
216
- *Gannon McGibbon*
386
+ * `bin/rails credentials:edit --environment foo` will create and edit
387
+ `config/credentials/foo.yml.enc` _if_ `config.credentials.content_path`
388
+ has not been set for the `foo` environment. Ultimately, it will edit
389
+ the credentials file that the app would load for the `foo` environment.
217
390
 
218
- * Remove redundant suffixes on generated integration tests.
391
+ *Jonathan Hefner*
219
392
 
220
- *Gannon McGibbon*
393
+ * Add descriptions for non-Rake commands when running `rails -h`.
221
394
 
222
- * Fix boolean interaction in scaffold system tests.
395
+ *Petrik de Heus*
223
396
 
224
- *Gannon McGibbon*
397
+ * Show relevant commands when calling help
225
398
 
226
- * Remove redundant suffixes on generated system tests.
399
+ When running `rails -h` or just `rails` outside a Rails application,
400
+ Rails outputs all options for running the `rails new` command. This can be
401
+ confusing to users when they probably want to see the common Rails commands.
227
402
 
228
- *Gannon McGibbon*
403
+ Instead, we should always show the common commands when running `rails -h`
404
+ inside or outside a Rails application.
229
405
 
230
- * Add an `abort_on_failure` boolean option to the generator method that shell
231
- out (`generate`, `rake`, `rails_command`) to abort the generator if the
232
- command fails.
406
+ As the relevant commands inside a Rails application differ from the
407
+ commands outside an application, the help USAGE file has been split to
408
+ show the most relevant commands for the context.
233
409
 
234
- *David Rodríguez*
410
+ *Petrik de Heus*
235
411
 
236
- * Remove `app/assets` and `app/javascript` from `eager_load_paths` and `autoload_paths`.
412
+ * Add Rails::HealthController#show and map it to /up for newly generated applications.
413
+ Load balancers and uptime monitors all need a basic endpoint to tell whether the app is up.
414
+ This is a good starting point that'll work in many situations.
237
415
 
238
- *Gannon McGibbon*
416
+ *DHH*
239
417
 
240
- * Use Ids instead of memory addresses when displaying references in scaffold views.
418
+ * Only use HostAuthorization middleware if `config.hosts` is not empty
241
419
 
242
- Fixes #29200.
420
+ *Hartley McGuire*
243
421
 
244
- *Rasesh Patel*
422
+ * Raise an exception when a `before_action`'s "only" or "except" filter
423
+ options reference an action that doesn't exist. This will be enabled by
424
+ default but can be overridden via config.
245
425
 
246
- * Adds support for multiple databases to `rails db:migrate:status`.
247
- Subtasks are also added to get the status of individual databases (eg. `rails db:migrate:status:animals`).
426
+ ```ruby
427
+ # config/environments/production.rb
428
+ config.action_controller.raise_on_missing_callback_actions = false
429
+ ```
248
430
 
249
- *Gannon McGibbon*
431
+ *Jess Bees*
432
+
433
+ * Use physical processor count as the default Puma worker count in production.
434
+ This can be overridden by setting `ENV["WEB_CONCURRENCY"]` or editing the
435
+ generated "config/puma.rb" directly.
436
+
437
+ *DHH*
438
+
439
+ * Add Docker files by default to new apps: Dockerfile, .dockerignore, bin/docker-entrypoint.
440
+ These files can be skipped with `--skip-docker`. They're intended as a starting point for
441
+ a production deploy of the application. Not intended for development (see Docked Rails for that).
442
+
443
+ Example:
250
444
 
251
- * Use Webpacker by default to manage app-level JavaScript through the new app/javascript directory.
252
- Sprockets is now solely in charge, by default, of compiling CSS and other static assets.
253
- Action Cable channel generators will create ES6 stubs rather than use CoffeeScript.
254
- Active Storage, Action Cable, Turbolinks, and Rails-UJS are loaded by a new application.js pack.
255
- Generators no longer generate JavaScript stubs.
445
+ ```bash
446
+ $ docker build -t app .
447
+ $ docker volume create app-storage
448
+ $ docker run --rm -it -v app-storage:/rails/storage -p 3000:3000 --env RAILS_MASTER_KEY=<see config/master.key> app
449
+ ```
450
+
451
+ You can also start a console or a runner from this image:
452
+
453
+ ```bash
454
+ $ docker run --rm -it -v app-storage:/rails/storage --env RAILS_MASTER_KEY=<see config/master.key> app console
455
+ ```
456
+
457
+ To create a multi-platform image on Apple Silicon to deploy on AMD or Intel and push to Docker Hub for user/app:
458
+
459
+ ```bash
460
+ $ docker login -u <user>
461
+ $ docker buildx create --use
462
+ $ docker buildx build --push --platform=linux/amd64,linux/arm64 -t <user/image> .
463
+ ```
464
+
465
+ *DHH, Sam Ruby*
466
+
467
+ * Add ENV["SECRET_KEY_BASE_DUMMY"] for starting production environment with a generated secret base key,
468
+ which can be used to run tasks like `assets:precompile` without making the RAILS_MASTER_KEY available
469
+ to the build process.
470
+
471
+ Dockerfile layer example:
472
+
473
+ ```
474
+ RUN SECRET_KEY_BASE_DUMMY=1 bundle exec rails assets:precompile
475
+ ```
476
+
477
+ *DHH*
478
+
479
+ * Show descriptions for all commands in Rails help
480
+
481
+ When calling `rails help` most commands missed their description. We now
482
+ show the same descriptions as shown in `rails -T`.
483
+
484
+ *Petrik de Heus*
485
+
486
+ * Always generate the storage/ directory with rails new to ensure there's a stable place to
487
+ put permanent files, and a single mount point for containers to map. Then default sqlite3 databases
488
+ to live there instead of db/, which is only meant for configuration, not data.
489
+
490
+ *DHH*
491
+
492
+ * Rails console now disables `IRB`'s autocompletion feature in production by default.
493
+
494
+ Setting `IRB_USE_AUTOCOMPLETE=true` can override this default.
495
+
496
+ *Stan Lo*
497
+
498
+ * Add `config.precompile_filter_parameters`, which enables precompilation of
499
+ `config.filter_parameters` using `ActiveSupport::ParameterFilter.precompile_filters`.
500
+ Precompilation can improve filtering performance, depending on the quantity
501
+ and types of filters.
502
+
503
+ `config.precompile_filter_parameters` defaults to `true` for
504
+ `config.load_defaults 7.1` and above.
256
505
 
257
- *DHH*, *Lachlan Sylvester*
506
+ *Jonathan Hefner*
258
507
 
259
- * Add `database` (aliased as `db`) option to model generator to allow
260
- setting the database. This is useful for applications that use
261
- multiple databases and put migrations per database in their own directories.
508
+ * Add `after_routes_loaded` hook to `Rails::Railtie::Configuration` for
509
+ engines to add a hook to be called after application routes have been
510
+ loaded.
262
511
 
512
+ ```ruby
513
+ MyEngine.config.after_routes_loaded do
514
+ # code that must happen after routes have been loaded
515
+ end
263
516
  ```
264
- bin/rails g model Room capacity:integer --database=kingston
265
- invoke active_record
266
- create db/kingston_migrate/20180830151055_create_rooms.rb
517
+
518
+ *Chris Salzberg*
519
+
520
+ * Send 303 See Other status code back for the destroy action on newly generated
521
+ scaffold controllers.
522
+
523
+ *Tony Drake*
524
+
525
+ * Add `Rails.application.deprecators` as a central point to manage deprecators
526
+ for an application.
527
+
528
+ Individual deprecators can be added and retrieved from the collection:
529
+
530
+ ```ruby
531
+ Rails.application.deprecators[:my_gem] = ActiveSupport::Deprecation.new("2.0", "MyGem")
532
+ Rails.application.deprecators[:other_gem] = ActiveSupport::Deprecation.new("3.0", "OtherGem")
533
+ ```
534
+
535
+ And the collection's configuration methods affect all deprecators in the
536
+ collection:
537
+
538
+ ```ruby
539
+ Rails.application.deprecators.debug = true
540
+
541
+ Rails.application.deprecators[:my_gem].debug
542
+ # => true
543
+ Rails.application.deprecators[:other_gem].debug
544
+ # => true
545
+ ```
546
+
547
+ Additionally, all deprecators in the collection can be silenced for the
548
+ duration of a given block:
549
+
550
+ ```ruby
551
+ Rails.application.deprecators.silence do
552
+ Rails.application.deprecators[:my_gem].warn # => silenced (no warning)
553
+ Rails.application.deprecators[:other_gem].warn # => silenced (no warning)
554
+ end
555
+ ```
556
+
557
+ *Jonathan Hefner*
558
+
559
+ * Move dbconsole logic to Active Record connection adapter.
560
+
561
+ Instead of hosting the connection logic in the command object, the
562
+ database adapter should be responsible for connecting to a console session.
563
+ This patch moves #find_cmd_and_exec to the adapter and exposes a new API to
564
+ lookup the adapter class without instantiating it.
565
+
566
+ *Gannon McGibbon*, *Paarth Madan*
567
+
568
+ * Add `Rails.application.message_verifiers` as a central point to configure
569
+ and create message verifiers for an application.
570
+
571
+ This allows applications to, for example, rotate old `secret_key_base`
572
+ values:
573
+
574
+ ```ruby
575
+ config.before_initialize do |app|
576
+ app.message_verifiers.rotate(secret_key_base: "old secret_key_base")
577
+ end
578
+ ```
579
+
580
+ And for libraries to create preconfigured message verifiers:
581
+
582
+ ```ruby
583
+ ActiveStorage.verifier = Rails.application.message_verifiers["ActiveStorage"]
267
584
  ```
268
585
 
269
- Because rails scaffolding uses the model generator, you can
270
- also specify a database with the scaffold generator.
586
+ *Jonathan Hefner*
587
+
588
+ * Support MySQL's ssl-mode option for the dbconsole command.
589
+
590
+ Verifying the identity of the database server requires setting the ssl-mode
591
+ option to VERIFY_CA or VERIFY_IDENTITY. This option was previously ignored
592
+ for the dbconsole command.
593
+
594
+ *Petrik de Heus*
595
+
596
+ * Delegate application record generator description to orm hooked generator.
271
597
 
272
598
  *Gannon McGibbon*
273
599
 
274
- * Raise an error when "recyclable cache keys" are being used by a cache store
275
- that does not explicitly support it. Custom cache keys that do support this feature
276
- can bypass this error by implementing the `supports_cache_versioning?` method on their
277
- class and returning a truthy value.
600
+ * Show BCC recipients when present in Action Mailer previews.
601
+
602
+ *Akshay Birajdar*
603
+
604
+ * Extend `routes --grep` to also filter routes by matching against path.
278
605
 
279
- *Richard Schneeman*
606
+ Example:
280
607
 
281
- * Support environment specific credentials overrides.
608
+ ```bash
609
+ $ bin/rails routes --grep /cats/1
610
+ Prefix Verb URI Pattern Controller#Action
611
+ cat GET /cats/:id(.:format) cats#show
612
+ PATCH /cats/:id(.:format) cats#update
613
+ PUT /cats/:id(.:format) cats#update
614
+ DELETE /cats/:id(.:format) cats#destroy
615
+ ```
616
+
617
+ *Orhan Toy*
618
+
619
+ * Improve `rails runner` output when given a file path that doesn't exist.
282
620
 
283
- So any environment will look for `config/credentials/#{Rails.env}.yml.enc` and fall back
284
- to `config/credentials.yml.enc`.
621
+ *Tekin Suleyman*
285
622
 
286
- The encryption key can be in `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key`.
623
+ * `config.allow_concurrency = false` now use a `Monitor` instead of a `Mutex`
287
624
 
288
- Environment credentials overrides can be edited with `rails credentials:edit --environment production`.
289
- If no override is set up for the passed environment, it will be created.
625
+ This allows to enable `config.active_support.executor_around_test_case` even
626
+ when `config.allow_concurrency` is disabled.
290
627
 
291
- Additionally, the default lookup paths can be overwritten with these configs:
628
+ *Jean Boussier*
292
629
 
293
- - `config.credentials.content_path`
294
- - `config.credentials.key_path`
630
+ * Add `routes --unused` option to detect extraneous routes.
295
631
 
296
- *Wojciech Wnętrzak*
632
+ Example:
297
633
 
298
- * Make `ActiveSupport::Cache::NullStore` the default cache store in the test environment.
634
+ ```bash
635
+ $ bin/rails routes --unused
299
636
 
300
- *Michael C. Nelson*
637
+ Found 2 unused routes:
301
638
 
302
- * Emit warning for unknown inflection rule when generating model.
639
+ Prefix Verb URI Pattern Controller#Action
640
+ one GET /one(.:format) action#one
641
+ two GET /two(.:format) action#two
642
+ ```
643
+
644
+ *Gannon McGibbon*
303
645
 
304
- *Yoshiyuki Kinjo*
646
+ * Add `--parent` option to controller generator to specify parent class of job.
305
647
 
306
- * Add `database` (aliased as `db`) option to migration generator.
648
+ Example:
307
649
 
308
- If you're using multiple databases and have a folder for each database
309
- for migrations (ex db/migrate and db/new_db_migrate) you can now pass the
310
- `--database` option to the generator to make sure the the migration
311
- is inserted into the correct folder.
650
+ `bin/rails g controller admin/users --parent=admin_controller` generates:
312
651
 
652
+ ```ruby
653
+ class Admin::UsersController < AdminController
654
+ # ...
655
+ end
313
656
  ```
314
- rails g migration CreateHouses --database=kingston
315
- invoke active_record
316
- create db/kingston_migrate/20180830151055_create_houses.rb
657
+
658
+ *Gannon McGibbon*
659
+
660
+ * In-app custom credentials templates are now supported. When a credentials
661
+ file does not exist, `rails credentials:edit` will now try to use
662
+ `lib/templates/rails/credentials/credentials.yml.tt` to generate the
663
+ credentials file, before falling back to the default template.
664
+
665
+ This allows e.g. an open-source Rails app (which would not include encrypted
666
+ credentials files in its repo) to include a credentials template, so that
667
+ users who install the app will get a custom pre-filled credentials file when
668
+ they run `rails credentials:edit`.
669
+
670
+ *Jonathan Hefner*
671
+
672
+ * Except for `dev` and `test` environments, newly generated per-environment
673
+ credentials files (e.g. `config/credentials/production.yml.enc`) now include
674
+ a `secret_key_base` for convenience, just as `config/credentials.yml.enc`
675
+ does.
676
+
677
+ *Jonathan Hefner*
678
+
679
+ * `--no-*` options now work with the app generator's `--minimal` option, and
680
+ are both comprehensive and precise. For example:
681
+
682
+ ```bash
683
+ $ rails new my_cool_app --minimal
684
+ Based on the specified options, the following options will also be activated:
685
+
686
+ --skip-active-job [due to --minimal]
687
+ --skip-action-mailer [due to --skip-active-job, --minimal]
688
+ --skip-active-storage [due to --skip-active-job, --minimal]
689
+ --skip-action-mailbox [due to --skip-active-storage, --minimal]
690
+ --skip-action-text [due to --skip-active-storage, --minimal]
691
+ --skip-javascript [due to --minimal]
692
+ --skip-hotwire [due to --skip-javascript, --minimal]
693
+ --skip-action-cable [due to --minimal]
694
+ --skip-bootsnap [due to --minimal]
695
+ --skip-dev-gems [due to --minimal]
696
+ --skip-system-test [due to --minimal]
697
+
698
+ ...
699
+
700
+ $ rails new my_cool_app --minimal --no-skip-active-storage
701
+ Based on the specified options, the following options will also be activated:
702
+
703
+ --skip-action-mailer [due to --minimal]
704
+ --skip-action-mailbox [due to --minimal]
705
+ --skip-action-text [due to --minimal]
706
+ --skip-javascript [due to --minimal]
707
+ --skip-hotwire [due to --skip-javascript, --minimal]
708
+ --skip-action-cable [due to --minimal]
709
+ --skip-bootsnap [due to --minimal]
710
+ --skip-dev-gems [due to --minimal]
711
+ --skip-system-test [due to --minimal]
712
+
713
+ ...
317
714
  ```
318
715
 
319
- *Eileen M. Uchitelle*
716
+ *Brad Trick* and *Jonathan Hefner*
717
+
718
+ * Add `--skip-dev-gems` option to app generator to skip adding development
719
+ gems (like `web-console`) to the Gemfile.
720
+
721
+ *Brad Trick*
722
+
723
+ * Skip Active Storage and Action Mailer if Active Job is skipped.
320
724
 
321
- * Deprecate `rake routes` in favor of `rails routes`.
725
+ *Étienne Barrié*
322
726
 
323
- *Yuji Yaginuma*
727
+ * Correctly check if frameworks are disabled when running app:update.
324
728
 
325
- * Deprecate `rake initializers` in favor of `rails initializers`.
729
+ *Étienne Barrié* and *Paulo Barros*
326
730
 
327
- *Annie-Claude Côté*
731
+ * Delegate model generator description to orm hooked generator.
328
732
 
329
- * Deprecate `rake dev:cache` in favor of `rails dev:cache`.
733
+ *Gannon McGibbon*
330
734
 
331
- *Annie-Claude Côté*
735
+ * Execute `rails runner` scripts inside the executor.
332
736
 
333
- * Deprecate `rails notes` subcommands in favor of passing an `annotations` argument to `rails notes`.
737
+ Enables error reporting, query cache, etc.
334
738
 
335
- The following subcommands are replaced by passing `--annotations` or `-a` to `rails notes`:
336
- - `rails notes:custom ANNOTATION=custom` is deprecated in favor of using `rails notes -a custom`.
337
- - `rails notes:optimize` is deprecated in favor of using `rails notes -a OPTIMIZE`.
338
- - `rails notes:todo` is deprecated in favor of using`rails notes -a TODO`.
339
- - `rails notes:fixme` is deprecated in favor of using `rails notes -a FIXME`.
739
+ *Jean Boussier*
340
740
 
341
- *Annie-Claude Côté*
741
+ * Avoid booting in development then test for test tasks.
342
742
 
343
- * Deprecate `SOURCE_ANNOTATION_DIRECTORIES` environment variable used by `rails notes`
344
- through `Rails::SourceAnnotationExtractor::Annotation` in favor of using `config.annotations.register_directories`.
743
+ Running one of the rails test subtasks (e.g. test:system, test:models) would
744
+ go through Rake and cause the app to be booted twice. Now all the test:*
745
+ subtasks are defined as Thor tasks and directly load the test environment.
345
746
 
346
- *Annie-Claude Côté*
747
+ *Étienne Barrié*
347
748
 
348
- * Deprecate `rake notes` in favor of `rails notes`.
749
+ * Deprecate `Rails::Generators::Testing::Behaviour` in favor of `Rails::Generators::Testing::Behavior`.
349
750
 
350
- *Annie-Claude Côté*
751
+ *Gannon McGibbon*
351
752
 
352
- * Don't generate unused files in `app:update` task.
753
+ * Allow configuration of logger size for local and test environments
353
754
 
354
- Skip the assets' initializer when sprockets isn't loaded.
755
+ `config.log_file_size`
355
756
 
356
- Skip `config/spring.rb` when spring isn't loaded.
757
+ Defaults to `100` megabytes.
357
758
 
358
- Skip yarn's contents when yarn integration isn't used.
759
+ *Bernie Chiu*
359
760
 
360
- *Tsukuru Tanimichi*
761
+ * Enroll new apps in decrypted diffs of credentials by default. This behavior
762
+ can be opted out of with the app generator's `--skip-decrypted-diffs` flag.
361
763
 
362
- * Make the master.key file read-only for the owner upon generation on
363
- POSIX-compliant systems.
764
+ *Jonathan Hefner*
364
765
 
365
- Previously:
766
+ * Support declarative-style test name filters with `bin/rails test`.
366
767
 
367
- $ ls -l config/master.key
368
- -rw-r--r-- 1 owner group 32 Jan 1 00:00 master.key
768
+ This makes it possible to run a declarative-style test such as:
369
769
 
370
- Now:
770
+ ```ruby
771
+ class MyTest < ActiveSupport::TestCase
772
+ test "does something" do
773
+ # ...
774
+ end
775
+ end
776
+ ```
371
777
 
372
- $ ls -l config/master.key
373
- -rw------- 1 owner group 32 Jan 1 00:00 master.key
778
+ Using its declared name:
374
779
 
375
- Fixes #32604.
780
+ ```bash
781
+ $ bin/rails test test/my_test.rb -n "does something"
782
+ ```
376
783
 
377
- *Jose Luis Duran*
784
+ Instead of having to specify its expanded method name:
378
785
 
379
- * Deprecate support for using the `HOST` environment variable to specify the server IP.
786
+ ```bash
787
+ $ bin/rails test test/my_test.rb -n test_does_something
788
+ ```
380
789
 
381
- The `BINDING` environment variable should be used instead.
790
+ *Jonathan Hefner*
382
791
 
383
- Fixes #29516.
792
+ * Add `--js` and `--skip-javascript` options to `rails new`
384
793
 
385
- *Yuji Yaginuma*
794
+ `--js` alias to `rails new --javascript ...`
386
795
 
387
- * Deprecate passing Rack server name as a regular argument to `rails server`.
796
+ Same as `-j`, e.g. `rails new --js esbuild ...`
388
797
 
389
- Previously:
798
+ `--skip-js` alias to `rails new --skip-javascript ...`
390
799
 
391
- $ bin/rails server thin
800
+ Same as `-J`, e.g. `rails new --skip-js ...`
392
801
 
393
- There wasn't an explicit option for the Rack server to use, now we have the
394
- `--using` option with the `-u` short switch.
802
+ *Dorian Marié*
395
803
 
396
- Now:
804
+ * Allow relative paths with leading dot slash to be passed to `rails test`.
397
805
 
398
- $ bin/rails server -u thin
806
+ Fix `rails test ./test/model/post_test.rb` to run a single test file.
399
807
 
400
- This change also improves the error message if a missing or mistyped rack
401
- server is given.
808
+ *Shouichi Kamiya* and *oljfte*
402
809
 
403
- *Genadi Samokovarov*
810
+ * 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.
404
811
 
405
- * Add "rails routes --expanded" option to output routes in expanded mode like
406
- "psql --expanded". Result looks like:
812
+ *Xavier Noria*
407
813
 
814
+ * 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.
815
+
816
+ *Xavier Noria*
817
+
818
+ * Add JavaScript dependencies installation on bin/setup
819
+
820
+ Add `yarn install` to bin/setup when using esbuild, webpack, or rollout.
821
+
822
+ *Carlos Ribeiro*
823
+
824
+ * Use `controller_class_path` in `Rails::Generators::NamedBase#route_url`
825
+
826
+ The `route_url` method now returns the correct path when generating
827
+ a namespaced controller with a top-level model using `--model-name`.
828
+
829
+ Previously, when running this command:
830
+
831
+ ```bash
832
+ $ bin/rails generate scaffold_controller Admin/Post --model-name Post
408
833
  ```
409
- $ rails routes --expanded
410
- --[ Route 1 ]------------------------------------------------------------
411
- Prefix | high_scores
412
- Verb | GET
413
- URI | /high_scores(.:format)
414
- Controller#Action | high_scores#index
415
- --[ Route 2 ]------------------------------------------------------------
416
- Prefix | new_high_score
417
- Verb | GET
418
- URI | /high_scores/new(.:format)
419
- Controller#Action | high_scores#new
834
+
835
+ the comments above the controller action would look like:
836
+
837
+ ``` ruby
838
+ # GET /posts
839
+ def index
840
+ @posts = Post.all
841
+ end
420
842
  ```
421
843
 
422
- *Benoit Tigeot*
844
+ afterwards, they now look like this:
845
+
846
+ ``` ruby
847
+ # GET /admin/posts
848
+ def index
849
+ @posts = Post.all
850
+ end
851
+ ```
852
+
853
+ Fixes #44662.
854
+
855
+ *Andrew White*
856
+
857
+ * No longer add autoloaded paths to `$LOAD_PATH`.
858
+
859
+ This means it won't be possible to load them with a manual `require` call, the class or module can be referenced instead.
860
+
861
+ Reducing the size of `$LOAD_PATH` speed-up `require` calls for apps not using `bootsnap`, and reduce the
862
+ size of the `bootsnap` cache for the others.
863
+
864
+ *Jean Boussier*
865
+
866
+ * Remove default `X-Download-Options` header
867
+
868
+ This header is currently only used by Internet Explorer which
869
+ will be discontinued in 2022 and since Rails 7 does not fully
870
+ support Internet Explorer this header should not be a default one.
871
+
872
+ *Harun Sabljaković*
873
+
874
+ * Add .node-version files for Rails apps that use Node.js
423
875
 
424
- * Rails 6 requires Ruby 2.5.0 or newer.
876
+ Node version managers that make use of this file:
877
+ https://github.com/shadowspawn/node-version-usage#node-version-file-usage
425
878
 
426
- *Jeremy Daer*, *Kasper Timm Hansen*
879
+ The generated Dockerfile will use the same node version.
427
880
 
881
+ *Sam Ruby*
428
882
 
429
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/railties/CHANGELOG.md) for previous changes.
883
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/railties/CHANGELOG.md) for previous changes.