railties 6.1.0 → 7.0.0

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 (161) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +121 -276
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.rdoc +16 -16
  5. data/README.rdoc +1 -2
  6. data/lib/rails/all.rb +0 -1
  7. data/lib/rails/api/task.rb +1 -1
  8. data/lib/rails/app_updater.rb +3 -5
  9. data/lib/rails/application/bootstrap.rb +21 -5
  10. data/lib/rails/application/configuration.rb +79 -33
  11. data/lib/rails/application/default_middleware_stack.rb +7 -3
  12. data/lib/rails/application/finisher.rb +42 -85
  13. data/lib/rails/application/routes_reloader.rb +8 -0
  14. data/lib/rails/application.rb +32 -51
  15. data/lib/rails/application_controller.rb +2 -2
  16. data/lib/rails/autoloaders/inflector.rb +21 -0
  17. data/lib/rails/autoloaders.rb +12 -16
  18. data/lib/rails/code_statistics.rb +2 -2
  19. data/lib/rails/code_statistics_calculator.rb +10 -1
  20. data/lib/rails/command/base.rb +26 -12
  21. data/lib/rails/command/behavior.rb +1 -1
  22. data/lib/rails/command/environment_argument.rb +1 -1
  23. data/lib/rails/command.rb +11 -10
  24. data/lib/rails/commands/credentials/USAGE +4 -2
  25. data/lib/rails/commands/credentials/credentials_command/diffing.rb +26 -16
  26. data/lib/rails/commands/credentials/credentials_command.rb +8 -3
  27. data/lib/rails/commands/dbconsole/dbconsole_command.rb +10 -11
  28. data/lib/rails/commands/help/USAGE +3 -2
  29. data/lib/rails/commands/notes/notes_command.rb +2 -2
  30. data/lib/rails/commands/runner/runner_command.rb +3 -2
  31. data/lib/rails/commands/server/server_command.rb +2 -5
  32. data/lib/rails/configuration.rb +18 -23
  33. data/lib/rails/engine/configuration.rb +3 -3
  34. data/lib/rails/engine.rb +18 -24
  35. data/lib/rails/gem_version.rb +2 -2
  36. data/lib/rails/generators/actions/create_migration.rb +4 -4
  37. data/lib/rails/generators/actions.rb +35 -13
  38. data/lib/rails/generators/app_base.rb +140 -102
  39. data/lib/rails/generators/app_name.rb +1 -1
  40. data/lib/rails/generators/base.rb +9 -13
  41. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -0
  42. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +8 -8
  43. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
  44. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
  45. data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
  46. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
  47. data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
  48. data/lib/rails/generators/erb.rb +1 -1
  49. data/lib/rails/generators/generated_attribute.rb +45 -9
  50. data/lib/rails/generators/migration.rb +2 -6
  51. data/lib/rails/generators/model_helpers.rb +1 -1
  52. data/lib/rails/generators/named_base.rb +11 -11
  53. data/lib/rails/generators/rails/app/app_generator.rb +54 -93
  54. data/lib/rails/generators/rails/app/templates/Gemfile.tt +42 -52
  55. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
  56. data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
  57. data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
  58. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +3 -9
  59. data/lib/rails/generators/rails/app/templates/bin/rails.tt +1 -4
  60. data/lib/rails/generators/rails/app/templates/bin/rake.tt +0 -3
  61. data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -14
  62. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +0 -1
  63. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +1 -1
  64. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +2 -2
  65. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +3 -3
  66. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +3 -3
  67. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +2 -2
  68. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
  69. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +2 -2
  70. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +3 -3
  71. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
  72. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +5 -5
  73. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +6 -12
  74. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +11 -38
  75. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +6 -11
  76. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -5
  77. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +19 -25
  78. data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +2 -2
  79. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
  80. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +117 -0
  81. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +3 -3
  82. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +1 -1
  83. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +4 -1
  84. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
  85. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +2 -2
  86. data/lib/rails/generators/rails/app/templates/gitattributes.tt +0 -5
  87. data/lib/rails/generators/rails/app/templates/gitignore.tt +3 -1
  88. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
  89. data/lib/rails/generators/rails/controller/controller_generator.rb +1 -2
  90. data/lib/rails/generators/rails/controller/templates/controller.rb.tt +0 -4
  91. data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
  92. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
  93. data/lib/rails/generators/rails/plugin/plugin_generator.rb +42 -24
  94. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +7 -3
  95. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +11 -20
  96. data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
  97. data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
  98. data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
  99. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +4 -5
  100. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -5
  101. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
  102. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
  103. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +2 -2
  104. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -7
  105. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +0 -19
  106. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -5
  107. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +6 -10
  108. data/lib/rails/generators/resource_helpers.rb +2 -2
  109. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +1 -1
  110. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +2 -2
  111. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
  112. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +5 -5
  113. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +7 -7
  114. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
  115. data/lib/rails/generators/testing/behaviour.rb +3 -4
  116. data/lib/rails/generators.rb +9 -22
  117. data/lib/rails/info.rb +1 -1
  118. data/lib/rails/info_controller.rb +1 -3
  119. data/lib/rails/initializable.rb +1 -1
  120. data/lib/rails/mailers_controller.rb +2 -4
  121. data/lib/rails/rack/logger.rb +0 -1
  122. data/lib/rails/railtie/configuration.rb +1 -2
  123. data/lib/rails/railtie.rb +31 -14
  124. data/lib/rails/ruby_version_check.rb +3 -3
  125. data/lib/rails/secrets.rb +4 -1
  126. data/lib/rails/source_annotation_extractor.rb +1 -1
  127. data/lib/rails/tasks/framework.rake +2 -8
  128. data/lib/rails/tasks/statistics.rake +3 -1
  129. data/lib/rails/tasks/tmp.rake +8 -1
  130. data/lib/rails/tasks/yarn.rake +10 -7
  131. data/lib/rails/tasks/zeitwerk.rake +2 -10
  132. data/lib/rails/templates/layouts/application.html.erb +15 -0
  133. data/lib/rails/templates/rails/mailers/email.html.erb +13 -11
  134. data/lib/rails/templates/rails/welcome/index.html.erb +62 -47
  135. data/lib/rails/test_unit/railtie.rb +0 -4
  136. data/lib/rails/test_unit/runner.rb +16 -9
  137. data/lib/rails/test_unit/testing.rake +4 -9
  138. data/lib/rails/welcome_controller.rb +1 -0
  139. data/lib/rails.rb +5 -0
  140. metadata +33 -36
  141. data/lib/rails/command/spellchecker.rb +0 -57
  142. data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
  143. data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
  144. data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
  145. data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
  146. data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
  147. data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
  148. data/lib/rails/generators/rails/app/templates/bin/spring.tt +0 -9
  149. data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -18
  150. data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
  151. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -8
  152. data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
  153. data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
  154. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +0 -63
  155. data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
  156. data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
  157. data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
  158. data/lib/rails/generators/rails/assets/USAGE +0 -16
  159. data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
  160. data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
  161. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1adfe379d94049a35a1306f22a5d1368e3b88455d57bb1e4764b845f7ec7e0c5
4
- data.tar.gz: 1ff026a5d1cc46e2cb543b15568fb2f12915d468a3c3723efd2daa18d70fc04a
3
+ metadata.gz: 5cb58ddc9e6fbbf28a0fb9c625cecec9cd282d59ccd697cf37cd1f78f7d25811
4
+ data.tar.gz: b6304f9dfa982671da582fb01c63f310b76d3d043aca2826ff5c54acecc7f90c
5
5
  SHA512:
6
- metadata.gz: 1b297610d901f515027eb7bb31b3bf912437ccc0643276ba5b166216fe41f8f6e74b42783002d8bd1a904fa512b18ffbcb258375d019299918a21c5b6c220cf6
7
- data.tar.gz: 9b1c0e55db347c811b93edb2e68dee00b99cd476e917de5e138c09faa4eaaaa1df3a374bc54b09934895c22993080e327d530129ba4163f209cd42d438deaabe
6
+ metadata.gz: febb1c2b1fc87226219dc2cf5870c236b801624c9a4d8c62b0853a1e3e033fbfec76e5b418de34774e069aa0b60d8b2c687c68ab729cc7165806974f16373b40
7
+ data.tar.gz: a6305f03e1ed58b3afd6a9647b6fb43a48007c08370db1e066c15e135ce159c9adc7ac84c318033264e1c18cafdf2d9446d3e08341e4922c46fb7c7b83a81ff7
data/CHANGELOG.md CHANGED
@@ -1,371 +1,216 @@
1
- ## Rails 6.1.0 (December 09, 2020) ##
1
+ ## Rails 7.0.0 (December 15, 2021) ##
2
2
 
3
- * Added `Railtie#server` hook called when Rails starts a server.
4
- This is useful in case your application or a library needs to run
5
- another process next to the Rails server. This is quite common in development
6
- for instance to run the Webpack or the React server.
3
+ * No changes.
7
4
 
8
- It can be used like this:
9
5
 
10
- ```ruby
11
- class MyRailtie < Rails::Railtie
12
- server do
13
- WebpackServer.run
14
- end
15
- end
16
- ```
17
-
18
- *Edouard Chin*
19
-
20
- * Remove deprecated `rake dev:cache` tasks.
21
-
22
- *Rafael Mendonça França*
23
-
24
- * Remove deprecated `rake routes` tasks.
25
-
26
- *Rafael Mendonça França*
27
-
28
- * Remove deprecated `rake initializers` tasks.
29
-
30
- *Rafael Mendonça França*
31
-
32
- * Remove deprecated support for using the `HOST` environment variable to specify the server IP.
33
-
34
- *Rafael Mendonça França*
35
-
36
- * Remove deprecated `server` argument from the rails server command.
6
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
37
7
 
38
- *Rafael Mendonça França*
8
+ * Allow localhost with a port by default in development
39
9
 
40
- * Remove deprecated `SOURCE_ANNOTATION_DIRECTORIES` environment variable support from `rails notes`.
10
+ [Fixes: #43864]
41
11
 
42
- *Rafael Mendonça França*
12
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
43
13
 
44
- * Remove deprecated `connection` option in the `rails dbconsole` command.
14
+ * No changes
45
15
 
46
- *Rafael Mendonça França*
16
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
47
17
 
48
- * Remove depreated `rake notes` tasks.
18
+ * Remove deprecated `config` in `dbconsole`.
49
19
 
50
20
  *Rafael Mendonça França*
51
21
 
52
- * Return a 405 Method Not Allowed response when a request uses an unknown HTTP method.
53
-
54
- Fixes #38998.
55
-
56
- *Loren Norman*
57
-
58
- * Make railsrc file location xdg-specification compliant
59
-
60
- `rails new` will now look for the default `railsrc` file at
61
- `$XDG_CONFIG_HOME/rails/railsrc` (or `~/.config/rails/railsrc` if
62
- `XDG_CONFIG_HOME` is not set). If this file does not exist, `rails new`
63
- will fall back to `~/.railsrc`.
64
-
65
- The fallback behaviour means this does not cause any breaking changes.
66
-
67
- *Nick Wolf*
68
-
69
- * Change the default logging level from :debug to :info to avoid inadvertent exposure of personally
70
- identifiable information (PII) in production environments.
71
-
72
- *Eric M. Payne*
73
-
74
- * Automatically generate abstract class when using multiple databases.
75
-
76
- When generating a scaffold for a multiple database application, Rails will now automatically generate the abstract class for the database when the database argument is passed. This abstract class will include the connection information for the writing configuration and any models generated for that database will automatically inherit from the abstract class.
77
-
78
- Usage:
79
-
80
- ```bash
81
- $ bin/rails generate scaffold Pet name:string --database=animals
82
- ```
22
+ * Change default `X-XSS-Protection` header to disable XSS auditor
83
23
 
84
- Will create an abstract class for the animals connection.
24
+ This header has been deprecated and the XSS auditor it triggered
25
+ has been removed from all major modern browsers (in favour of
26
+ Content Security Policy) that implemented this header to begin with
27
+ (Firefox never did).
85
28
 
86
- ```ruby
87
- class AnimalsRecord < ApplicationRecord
88
- self.abstract_class = true
29
+ [OWASP](https://owasp.org/www-project-secure-headers/#x-xss-protection)
30
+ suggests setting this header to '0' to disable the default behaviour
31
+ on old browsers as it can introduce additional security issues.
89
32
 
90
- connects_to database: { writing: :animals }
91
- end
92
- ```
33
+ Added the new behaviour as a framework default from Rails 7.0.
93
34
 
94
- And generate a `Pet` model that inherits from the new `AnimalsRecord`:
35
+ *Christian Sutter*
95
36
 
96
- ```ruby
97
- class Pet < AnimalsRecord
98
- end
99
- ```
37
+ * Scaffolds now use date_field, time_field and datetime_field instead of
38
+ date_select, time_select and datetime_select; thus providing native date/time pickers.
100
39
 
101
- If you already have an abstract class and it follows a different pattern than Rails defaults, you can pass a parent class with the database argument.
40
+ *Martijn Lafeber*
102
41
 
103
- ```bash
104
- $ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
105
- ```
106
-
107
- This will ensure the model inherits from the `SecondaryBase` parent instead of `AnimalsRecord`
108
-
109
- ```ruby
110
- class Pet < SecondaryBase
111
- end
112
- ```
113
-
114
- *Eileen M. Uchitelle*, *John Crepezzi*
115
-
116
- * Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
117
-
118
- *Chris Oliver*
119
-
120
- * Create a new rails app using a minimal stack.
121
-
122
- `rails new cool_app --minimal`
123
-
124
- All the following are excluded from your minimal stack:
125
-
126
- - action_cable
127
- - action_mailbox
128
- - action_mailer
129
- - action_text
130
- - active_job
131
- - active_storage
132
- - bootsnap
133
- - jbuilder
134
- - spring
135
- - system_tests
136
- - turbolinks
137
- - webpack
138
-
139
- *Haroon Ahmed*, *DHH*
140
-
141
- * Add default ENV variable option with BACKTRACE to turn off backtrace cleaning when debugging framework code in the
142
- generated config/initializers/backtrace_silencers.rb.
143
-
144
- `BACKTRACE=1 ./bin/rails runner "MyClass.perform"`
145
-
146
- *DHH*
147
-
148
- * The autoloading guide for Zeitwerk mode documents how to autoload classes
149
- during application boot in a safe way.
150
-
151
- *Haroon Ahmed*, *Xavier Noria*
152
-
153
- * The `classic` autoloader starts its deprecation cycle.
154
-
155
- New Rails projects are strongly discouraged from using `classic`, and we recommend that existing projects running on `classic` switch to `zeitwerk` mode when upgrading. Please check the [_Upgrading Ruby on Rails_](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html) guide for tips.
42
+ * Fix a regression in which autoload paths were initialized too late.
156
43
 
157
44
  *Xavier Noria*
158
45
 
159
- * Adds `rails test:all` for running all tests in the test directory.
160
-
161
- This runs all test files in the test directory, including system tests.
162
-
163
- *Niklas Häusele*
46
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
164
47
 
165
- * Add `config.generators.after_generate` for processing to generated files.
48
+ * Fix activestorage dependency in the npm package.
166
49
 
167
- Register a callback that will get called right after generators has finished.
168
-
169
- *Yuji Yaginuma*
170
-
171
- * Make test file patterns configurable via Environment variables
172
-
173
- This makes test file patterns configurable via two environment variables:
174
- `DEFAULT_TEST`, to configure files to test, and `DEFAULT_TEST_EXCLUDE`,
175
- to configure files to exclude from testing.
50
+ *Rafael Mendonça França*
176
51
 
177
- These values were hardcoded before, which made it difficult to add
178
- new categories of tests that should not be executed by default (e.g:
179
- smoke tests).
52
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
180
53
 
181
- *Jorge Manrubia*
54
+ * New and upgraded Rails apps no longer generate `config/initializers/application_controller_renderer.rb`
55
+ or `config/initializers/cookies_serializer.rb`
182
56
 
183
- * No longer include `rake rdoc` task when generating plugins.
57
+ The default value for `cookies_serializer` (`:json`) has been moved to `config.load_defaults("7.0")`.
58
+ The new framework defaults file can be used to upgrade the serializer.
184
59
 
185
- To generate docs, use the `rdoc lib` command instead.
60
+ *Alex Ghiculescu*
186
61
 
187
- *Jonathan Hefner*
62
+ * New applications get a dependency on the new `debug` gem, replacing `byebug`.
188
63
 
189
- * Allow relative paths with trailing slashes to be passed to `rails test`.
64
+ *Xavier Noria*
190
65
 
191
- *Eugene Kenny*
66
+ * Add SSL support for postgresql in `bin/rails dbconsole`.
192
67
 
193
- * Add `rack-mini-profiler` gem to the default `Gemfile`.
68
+ Fixes #43114.
194
69
 
195
- `rack-mini-profiler` displays performance information such as SQL time and flame graphs.
196
- It's enabled by default in development environment, but can be enabled in production as well.
197
- See the gem [README](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md) for information on how to enable it in production.
70
+ *Michael Bayucot*
198
71
 
199
- *Osama Sayegh*
72
+ * Add support for comments above gem declaration in Rails application templates, e.g. `gem("nokogiri", comment: "For XML")`.
200
73
 
201
- * `rails stats` will now count TypeScript files toward JavaScript stats.
74
+ *Linas Juškevičius*
202
75
 
203
- *Joshua Cody*
76
+ * The setter `config.autoloader=` has been deleted. `zeitwerk` is the only
77
+ available autoloading mode.
204
78
 
205
- * Run `git init` when generating plugins.
79
+ *Xavier Noria*
206
80
 
207
- Opt out with `--skip-git`.
81
+ * `config.autoload_once_paths` can be configured in the body of the
82
+ application class defined in `config/application.rb` or in the configuration
83
+ for environments in `config/environments/*`.
208
84
 
209
- *OKURA Masafumi*
85
+ Similarly, engines can configure that collection in the class body of the
86
+ engine class or in the configuration for environments.
210
87
 
211
- * Add benchmark generator.
88
+ After that, the collection is frozen, and you can autoload from those paths.
89
+ They are managed by the `Rails.autoloaders.once` autoloader, which does not
90
+ reload, only autoloads/eager loads.
212
91
 
213
- Introduce benchmark generator to benchmark Rails applications.
92
+ *Xavier Noria*
214
93
 
215
- `rails generate benchmark opt_compare`
94
+ * During initialization, you cannot autoload reloadable classes or modules
95
+ like application models, unless they are wrapped in a `to_prepare` block.
96
+ For example, from `config/initializers/*`, or in application, engines, or
97
+ railties initializers.
216
98
 
217
- This creates a benchmark file that uses [`benchmark-ips`](https://github.com/evanphx/benchmark-ips).
218
- By default, two code blocks can be benchmarked using the `before` and `after` reports.
99
+ Please check the [autoloading
100
+ guide](https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots)
101
+ for details.
219
102
 
220
- You can run the generated benchmark file using:
221
- `ruby script/benchmarks/opt_compare.rb`
103
+ *Xavier Noria*
222
104
 
223
- *Kevin Jalbert*, *Gannon McGibbon*
105
+ * While they are allowed to have elements in common, it is no longer required
106
+ that `config.autoload_once_paths` is a subset of `config.autoload_paths`.
107
+ The former are managed by the `once` autoloader. The `main` autoloader
108
+ manages the latter minus the former.
224
109
 
225
- * Cache compiled view templates when running tests by default.
110
+ *Xavier Noria*
226
111
 
227
- When generating a new app without `--skip-spring`, caching classes is
228
- disabled in `environments/test.rb`. This implicitly disables caching
229
- view templates too. This change will enable view template caching by
230
- adding this to the generated `environments/test.rb`:
112
+ * Show Rake task description if command is run with `-h`.
231
113
 
232
- ```ruby
233
- config.action_view.cache_template_loading = true
234
- ```
114
+ Adding `-h` (or `--help`) to a Rails command that's a Rake task now outputs
115
+ the task description instead of the general Rake help.
235
116
 
236
- *Jorge Manrubia*
117
+ *Petrik de Heus*
237
118
 
238
- * Introduce middleware move operations.
119
+ * Add missing `plugin new` command to help.
239
120
 
240
- With this change, you no longer need to delete and reinsert a middleware to
241
- move it from one place to another in the stack:
121
+ *Petrik de Heus
242
122
 
243
- ```ruby
244
- config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
245
- ```
123
+ * Fix `config_for` error when there's only a shared root array.
246
124
 
247
- This will move the `Magical::Unicorns` middleware before
248
- `ActionDispatch::Flash`. You can also move it after with:
125
+ *Loïc Delmaire*
249
126
 
250
- ```ruby
251
- config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
252
- ```
127
+ * Raise an error in generators if an index type is invalid.
253
128
 
254
- *Genadi Samokovarov*
129
+ *Petrik de Heus*
255
130
 
256
- * Generators that inherit from NamedBase respect `--force` option.
131
+ * `package.json` now uses a strict version constraint for Rails JavaScript packages on new Rails apps.
257
132
 
258
- *Josh Brody*
133
+ *Zachary Scott*, *Alex Ghiculescu*
259
134
 
260
- * Allow configuration of eager_load behaviour for rake environment:
135
+ * Modified scaffold generator template so that running
136
+ `rails g scaffold Author` no longer generates tests called "creating
137
+ a Author", "updating a Author", and "destroying a Author".
261
138
 
262
- config.rake_eager_load
139
+ Fixes #40744.
263
140
 
264
- Defaults to `false` as per previous behaviour.
141
+ *Michael Duchemin*
265
142
 
266
- *Thierry Joyal*
143
+ * Raise an error in generators if a field type is invalid.
267
144
 
268
- * Ensure Rails migration generator respects system-wide primary key config.
145
+ *Petrik de Heus*
269
146
 
270
- When rails is configured to use a specific primary key type:
147
+ * `bin/rails tmp:clear` deletes also files and directories in `tmp/storage`.
271
148
 
272
- ```ruby
273
- config.generators do |g|
274
- g.orm :active_record, primary_key_type: :uuid
275
- end
276
- ```
149
+ *George Claghorn*
277
150
 
278
- Previously:
151
+ * Fix compatibility with `psych >= 4`.
279
152
 
280
- ```bash
281
- $ bin/rails g migration add_location_to_users location:references
282
- ```
153
+ Starting in Psych 4.0.0 `YAML.load` behaves like `YAML.safe_load`. To preserve compatibility
154
+ `Rails.application.config_for` now uses `YAML.unsafe_load` if available.
283
155
 
284
- The references line in the migration would not have `type: :uuid`.
285
- This change causes the type to be applied appropriately.
156
+ *Jean Boussier*
286
157
 
287
- *Louis-Michel Couture*, *Dermot Haughey*
158
+ * Allow loading nested locales in engines.
288
159
 
289
- * Deprecate `Rails::DBConsole#config`.
160
+ *Gannon McGibbon*
290
161
 
291
- `Rails::DBConsole#config` is deprecated without replacement. Use `Rails::DBConsole.db_config.configuration_hash` instead.
162
+ * Ensure `Rails.application.config_for` always cast hashes to `ActiveSupport::OrderedOptions`.
292
163
 
293
- *Eileen M. Uchitelle*, *John Crepezzi*
164
+ *Jean Boussier*
294
165
 
295
- * `Rails.application.config_for` merges shared configuration deeply.
166
+ * Remove `Rack::Runtime` from the default middleware stack and deprecate
167
+ referencing it in middleware operations without adding it back.
296
168
 
297
- ```yaml
298
- # config/example.yml
299
- shared:
300
- foo:
301
- bar:
302
- baz: 1
303
- development:
304
- foo:
305
- bar:
306
- qux: 2
307
- ```
169
+ *Hartley McGuire*
308
170
 
309
- ```ruby
310
- # Previously
311
- Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 }
171
+ * Allow adding additional authorized hosts in development via `ENV['RAILS_DEVELOPMENT_HOSTS']`.
312
172
 
313
- # Now
314
- Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
315
- ```
173
+ *Josh Abernathy*, *Debbie Milburn*
316
174
 
317
- *Yuhei Kiriyama*
175
+ * Add app concern and test keepfiles to generated engine plugins.
318
176
 
319
- * Remove access to values in nested hashes returned by `Rails.application.config_for` via String keys.
177
+ *Gannon McGibbon*
320
178
 
321
- ```yaml
322
- # config/example.yml
323
- development:
324
- options:
325
- key: value
326
- ```
179
+ * Stop generating a license for in-app plugins.
327
180
 
328
- ```ruby
329
- Rails.application.config_for(:example).options
330
- ```
181
+ *Gannon McGibbon*
331
182
 
332
- This used to return a Hash on which you could access values with String keys. This was deprecated in 6.0, and now doesn't work anymore.
183
+ * `rails app:update` no longer prompts you to overwrite files that are generally modified in the
184
+ course of developing a Rails app. See [#41083](https://github.com/rails/rails/pull/41083) for
185
+ the full list of changes.
333
186
 
334
- *Étienne Barrié*
187
+ *Alex Ghiculescu*
335
188
 
336
- * Configuration files for environments (`config/environments/*.rb`) are
337
- now able to modify `autoload_paths`, `autoload_once_paths`, and
338
- `eager_load_paths`.
189
+ * Change default branch for new Rails projects and plugins to `main`.
339
190
 
340
- As a consequence, applications cannot autoload within those files. Before, they technically could, but changes in autoloaded classes or modules had no effect anyway in the configuration because reloading does not reboot.
191
+ *Prateek Choudhary*
341
192
 
342
- Ways to use application code in these files:
193
+ * The new method `Rails.benchmark` gives you a quick way to measure and log the execution time taken by a block:
343
194
 
344
- * Define early in the boot process a class that is not reloadable, from which the application takes configuration values that get passed to the framework.
195
+ def test_expensive_stuff
196
+ Rails.benchmark("test_expensive_stuff") { ... }
197
+ end
345
198
 
346
- ```ruby
347
- # In config/application.rb, for example.
348
- require "#{Rails.root}/lib/my_app/config"
199
+ This functionality was available in some contexts only before.
349
200
 
350
- # In config/environments/development.rb, for example.
351
- config.foo = MyApp::Config.foo
352
- ```
201
+ *Simon Perepelitsa*
353
202
 
354
- * If the class has to be reloadable, then wrap the configuration code in a `to_prepare` block:
203
+ * Applications generated with `--skip-sprockets` no longer get `app/assets/config/manifest.js` and `app/assets/stylesheets/application.css`.
355
204
 
356
- ```ruby
357
- config.to_prepare do
358
- config.foo = MyModel.foo
359
- end
360
- ```
205
+ *Cindy Gao*
361
206
 
362
- That assigns the latest `MyModel.foo` to `config.foo` when the application boots, and each time there is a reload. But whether that has an effect or not depends on the configuration point, since it is not uncommon for engines to read the application configuration during initialization and set their own state from them. That process happens only on boot, not on reloads, and if that is how `config.foo` worked, resetting it would have no effect in the state of the engine.
207
+ * Add support for stylesheets and ERB views to `rails stats`.
363
208
 
364
- *Allen Hsu* & *Xavier Noria*
209
+ *Joel Hawksley*
365
210
 
366
- * Support using environment variable to set pidfile.
211
+ * Allow appended root routes to take precedence over internal welcome controller.
367
212
 
368
- *Ben Thorner*
213
+ *Gannon McGibbon*
369
214
 
370
215
 
371
- Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/railties/CHANGELOG.md) for previous changes.
216
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/railties/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2020 David Heinemeier Hansson
1
+ Copyright (c) 2004-2021 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/RDOC_MAIN.rdoc CHANGED
@@ -15,21 +15,21 @@ application into three layers: Model, View, and Controller, each with a specific
15
15
  The <em><b>Model layer</b></em> represents the domain model (such as Account, Product,
16
16
  Person, Post, etc.) and encapsulates the business logic specific to
17
17
  your application. In \Rails, database-backed model classes are derived from
18
- <tt>ActiveRecord::Base</tt>. {Active Record}[link:files/activerecord/README_rdoc.html] allows you to present the data from
18
+ <tt>ActiveRecord::Base</tt>. {Active Record}[link:/files/activerecord/README_rdoc.html] allows you to present the data from
19
19
  database rows as objects and embellish these data objects with business logic
20
20
  methods. Although most \Rails models are backed by a database, models can also be ordinary
21
21
  Ruby classes, or Ruby classes that implement a set of interfaces as provided by
22
- the {Active Model}[link:files/activemodel/README_rdoc.html] module.
22
+ the {Active Model}[link:/files/activemodel/README_rdoc.html] module.
23
23
 
24
24
  == Controller layer
25
25
 
26
26
  The <em><b>Controller layer</b></em> is responsible for handling incoming HTTP requests and
27
- providing a suitable response. Usually this means returning \HTML, but \Rails controllers
27
+ providing a suitable response. Usually, this means returning \HTML, but \Rails controllers
28
28
  can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and
29
- manipulate models, and render view templates in order to generate the appropriate HTTP response.
29
+ manipulate models and render view templates in order to generate the appropriate HTTP response.
30
30
  In \Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and
31
31
  controller classes are derived from <tt>ActionController::Base</tt>. Action Dispatch and Action Controller
32
- are bundled together in {Action Pack}[link:files/actionpack/README_rdoc.html].
32
+ are bundled together in {Action Pack}[link:/files/actionpack/README_rdoc.html].
33
33
 
34
34
  == View layer
35
35
 
@@ -37,19 +37,19 @@ The <em><b>View layer</b></em> is composed of "templates" that are responsible f
37
37
  appropriate representations of your application's resources. Templates can
38
38
  come in a variety of formats, but most view templates are \HTML with embedded
39
39
  Ruby code (ERB files). Views are typically rendered to generate a controller response,
40
- or to generate the body of an email. In \Rails, View generation is handled by {Action View}[link:files/actionview/README_rdoc.html].
40
+ or to generate the body of an email. In \Rails, View generation is handled by {Action View}[link:/files/actionview/README_rdoc.html].
41
41
 
42
42
  == Frameworks and libraries
43
43
 
44
- {Active Record}[link:files/activerecord/README_rdoc.html], {Active Model}[link:files/activemodel/README_rdoc.html],
45
- {Action Pack}[link:files/actionpack/README_rdoc.html], and {Action View}[link:files/actionview/README_rdoc.html] can each be used independently outside \Rails.
46
- In addition to that, \Rails also comes with {Action Mailer}[link:files/actionmailer/README_rdoc.html], a library
47
- to generate and send emails; {Action Mailbox}[link:files/actionmailbox/README_md.html], a library to receive emails within a Rails application;
48
- {Active Job}[link:files/activejob/README_md.html], a framework for declaring jobs and making them run on a variety of queueing
49
- backends; {Action Cable}[link:files/actioncable/README_md.html], a framework to
50
- integrate WebSockets with a \Rails application; {Active Storage}[link:files/activestorage/README_md.html],
51
- a library to attach cloud and local files to \Rails applications; {Action Text}[link:files/actiontext/README_md.html], a library to handle rich text content;
52
- and {Active Support}[link:files/activesupport/README_rdoc.html], a collection
44
+ {Active Record}[link:/files/activerecord/README_rdoc.html], {Active Model}[link:/files/activemodel/README_rdoc.html],
45
+ {Action Pack}[link:/files/actionpack/README_rdoc.html], and {Action View}[link:/files/actionview/README_rdoc.html] can each be used independently outside \Rails.
46
+ In addition to that, \Rails also comes with {Action Mailer}[link:/files/actionmailer/README_rdoc.html], a library
47
+ to generate and send emails; {Action Mailbox}[link:/files/actionmailbox/README_md.html], a library to receive emails within a Rails application;
48
+ {Active Job}[link:/files/activejob/README_md.html], a framework for declaring jobs and making them run on a variety of queueing
49
+ backends; {Action Cable}[link:/files/actioncable/README_md.html], a framework to
50
+ integrate WebSockets with a \Rails application; {Active Storage}[link:/files/activestorage/README_md.html],
51
+ a library to attach cloud and local files to \Rails applications; {Action Text}[link:/files/actiontext/README_md.html], a library to handle rich text content;
52
+ and {Active Support}[link:/files/activesupport/README_rdoc.html], a collection
53
53
  of utility classes and standard library extensions that are useful for \Rails,
54
54
  and may also be used independently outside \Rails.
55
55
 
@@ -72,7 +72,7 @@ and may also be used independently outside \Rails.
72
72
 
73
73
  Run with <tt>--help</tt> or <tt>-h</tt> for options.
74
74
 
75
- 4. Go to <tt>http://localhost:3000</tt> and you'll see: "Yay! You’re on \Rails!"
75
+ 4. Go to <tt>http://localhost:3000</tt>, and you'll see: "Yay! You’re on \Rails!"
76
76
 
77
77
  5. Follow the guidelines to start developing your application. You may find the following resources handy:
78
78
 
data/README.rdoc CHANGED
@@ -8,7 +8,6 @@ Railties is responsible for gluing all frameworks together. Overall, it:
8
8
 
9
9
  * and provides the Rails generators core.
10
10
 
11
-
12
11
  == Download
13
12
 
14
13
  The latest version of Railties can be installed with RubyGems:
@@ -17,7 +16,7 @@ The latest version of Railties can be installed with RubyGems:
17
16
 
18
17
  Source code can be downloaded as part of the Rails project on GitHub
19
18
 
20
- * https://github.com/rails/rails/tree/master/railties
19
+ * https://github.com/rails/rails/tree/main/railties
21
20
 
22
21
  == License
23
22
 
data/lib/rails/all.rb CHANGED
@@ -15,7 +15,6 @@ require "rails"
15
15
  action_mailbox/engine
16
16
  action_text/engine
17
17
  rails/test_unit/railtie
18
- sprockets/railtie
19
18
  ).each do |railtie|
20
19
  begin
21
20
  require railtie
@@ -189,7 +189,7 @@ module Rails
189
189
 
190
190
  class EdgeTask < RepoTask
191
191
  def rails_version
192
- "master@#{`git rev-parse HEAD`[0, 7]}"
192
+ "main@#{`git rev-parse HEAD`[0, 7]}"
193
193
  end
194
194
  end
195
195
 
@@ -13,7 +13,7 @@ module Rails
13
13
  def app_generator
14
14
  @app_generator ||= begin
15
15
  gen = Rails::Generators::AppGenerator.new ["rails"], generator_options, destination_root: Rails.root
16
- File.exist?(Rails.root.join("config", "application.rb")) ? gen.send(:app_const) : gen.send(:valid_const?)
16
+ gen.send(:valid_const?) unless File.exist?(Rails.root.join("config", "application.rb"))
17
17
  gen
18
18
  end
19
19
  end
@@ -21,15 +21,13 @@ module Rails
21
21
  private
22
22
  def generator_options
23
23
  options = { api: !!Rails.application.config.api_only, update: true }
24
- options[:skip_javascript] = !File.exist?(Rails.root.join("bin", "yarn"))
25
24
  options[:skip_active_record] = !defined?(ActiveRecord::Railtie)
26
25
  options[:skip_active_storage] = !defined?(ActiveStorage::Engine) || !defined?(ActiveRecord::Railtie)
27
26
  options[:skip_action_mailer] = !defined?(ActionMailer::Railtie)
28
27
  options[:skip_action_cable] = !defined?(ActionCable::Engine)
29
- options[:skip_sprockets] = !defined?(Sprockets::Railtie)
30
- options[:skip_puma] = !defined?(Puma)
28
+ options[:skip_asset_pipeline] = !defined?(Sprockets::Railtie) && !defined?(Propshaft::Railtie)
31
29
  options[:skip_bootsnap] = !defined?(Bootsnap)
32
- options[:skip_spring] = !defined?(Spring)
30
+ options[:updating] = true
33
31
  options
34
32
  end
35
33
  end