railties 7.0.0.alpha2 → 7.0.0.rc1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -1
- data/lib/rails/all.rb +0 -1
- data/lib/rails/app_updater.rb +1 -1
- data/lib/rails/application/bootstrap.rb +6 -2
- data/lib/rails/application/configuration.rb +17 -6
- data/lib/rails/application/default_middleware_stack.rb +2 -1
- data/lib/rails/application/finisher.rb +2 -3
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +0 -5
- data/lib/rails/engine/configuration.rb +1 -1
- data/lib/rails/engine.rb +3 -5
- data/lib/rails/gem_version.rb +1 -1
- data/lib/rails/generators/app_base.rb +44 -14
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +1 -1
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +8 -8
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +2 -2
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +5 -5
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +1 -1
- data/lib/rails/generators/generated_attribute.rb +5 -5
- data/lib/rails/generators/rails/app/app_generator.rb +12 -6
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +14 -9
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +1 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +0 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +12 -2
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +19 -20
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +36 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/gitignore.tt +3 -0
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +1 -1
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +3 -1
- data/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +0 -1
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +7 -9
- data/lib/rails/railtie.rb +18 -1
- data/lib/rails/tasks/yarn.rake +4 -9
- data/lib/rails/templates/rails/mailers/email.html.erb +1 -1
- data/lib/rails/test_unit/runner.rb +9 -4
- data/lib/rails/welcome_controller.rb +1 -0
- data/lib/rails.rb +4 -0
- metadata +17 -19
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e2ddd18e2ff116d8c83d8e95fba5020e6e221923a1f0db63c3780ffb0ae8c2c
|
|
4
|
+
data.tar.gz: 7ddefdb7942432d8488586a2a7729b5b516643f6c35bca1965c7a0669769146c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c40e67a84ec3021669d095b54de27f082ef6bbecf694ae55d3aa453bcda4bfb70cce76706631d69788fdebbccd7f241d1a28d331fc05c0837e26c9167e6bcd65
|
|
7
|
+
data.tar.gz: 1e116ab0b19f6ca8cc013475bd1c996a4c89f543986bdd3de566dc7229ef765b44a9dee4da2263e6780e2889d37439c1b83c69d1539d9dbfcd1733ce924bbc2f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
* Remove deprecated `config` in `dbconsole`.
|
|
2
|
+
|
|
3
|
+
*Rafael Mendonça França*
|
|
4
|
+
|
|
5
|
+
* Change default `X-XSS-Protection` header to disable XSS auditor
|
|
6
|
+
|
|
7
|
+
This header has been deprecated and the XSS auditor it triggered
|
|
8
|
+
has been removed from all major modern browsers (in favour of
|
|
9
|
+
Content Security Policy) that implemented this header to begin with
|
|
10
|
+
(Firefox never did).
|
|
11
|
+
|
|
12
|
+
[OWASP](https://owasp.org/www-project-secure-headers/#x-xss-protection)
|
|
13
|
+
suggests setting this header to '0' to disable the default behaviour
|
|
14
|
+
on old browsers as it can introduce additional security issues.
|
|
15
|
+
|
|
16
|
+
Added the new behaviour as a framework default from Rails 7.0.
|
|
17
|
+
|
|
18
|
+
*Christian Sutter*
|
|
19
|
+
|
|
20
|
+
* Scaffolds now use date_field, time_field and datetime_field instead of
|
|
21
|
+
date_select, time_select and datetime_select; thus providing native date/time pickers.
|
|
22
|
+
|
|
23
|
+
*Martijn Lafeber*
|
|
24
|
+
|
|
25
|
+
* Fix a regression in which autoload paths were initialized too late.
|
|
26
|
+
|
|
27
|
+
*Xavier Noria*
|
|
28
|
+
|
|
1
29
|
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
|
2
30
|
|
|
3
31
|
* Fix activestorage dependency in the npm package.
|
|
@@ -10,7 +38,7 @@
|
|
|
10
38
|
or `config/initializers/cookies_serializer.rb`
|
|
11
39
|
|
|
12
40
|
The default value for `cookies_serializer` (`:json`) has been moved to `config.load_defaults("7.0")`.
|
|
13
|
-
The new framework defaults file
|
|
41
|
+
The new framework defaults file can be used to upgrade the serializer.
|
|
14
42
|
|
|
15
43
|
*Alex Ghiculescu*
|
|
16
44
|
|
data/lib/rails/all.rb
CHANGED
data/lib/rails/app_updater.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Rails
|
|
|
25
25
|
options[:skip_active_storage] = !defined?(ActiveStorage::Engine) || !defined?(ActiveRecord::Railtie)
|
|
26
26
|
options[:skip_action_mailer] = !defined?(ActionMailer::Railtie)
|
|
27
27
|
options[:skip_action_cable] = !defined?(ActionCable::Engine)
|
|
28
|
-
options[:
|
|
28
|
+
options[:skip_asset_pipeline] = !defined?(Sprockets::Railtie) && !defined?(Propshaft::Railtie)
|
|
29
29
|
options[:skip_bootsnap] = !defined?(Bootsnap)
|
|
30
30
|
options[:updating] = true
|
|
31
31
|
options
|
|
@@ -14,6 +14,7 @@ module Rails
|
|
|
14
14
|
initializer :load_environment_hook, group: :all do end
|
|
15
15
|
|
|
16
16
|
initializer :load_active_support, group: :all do
|
|
17
|
+
ENV["RAILS_DISABLE_DEPRECATED_TO_S_CONVERSION"] = "true" if config.active_support.disable_to_s_conversion
|
|
17
18
|
require "active_support/all" unless config.active_support.bare
|
|
18
19
|
end
|
|
19
20
|
|
|
@@ -49,8 +50,11 @@ module Rails
|
|
|
49
50
|
)
|
|
50
51
|
logger
|
|
51
52
|
end
|
|
52
|
-
|
|
53
53
|
Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
|
|
54
|
+
|
|
55
|
+
unless config.consider_all_requests_local
|
|
56
|
+
Rails.error.logger = Rails.logger
|
|
57
|
+
end
|
|
54
58
|
end
|
|
55
59
|
|
|
56
60
|
# Initialize cache early in the stack so railties can make use of it.
|
|
@@ -66,7 +70,7 @@ module Rails
|
|
|
66
70
|
|
|
67
71
|
# We setup the once autoloader this early so that engines and applications
|
|
68
72
|
# are able to autoload from these paths during initialization.
|
|
69
|
-
initializer :setup_once_autoloader do
|
|
73
|
+
initializer :setup_once_autoloader, after: :set_eager_load_paths, before: :bootstrap_hook do
|
|
70
74
|
autoloader = Rails.autoloaders.once
|
|
71
75
|
|
|
72
76
|
ActiveSupport::Dependencies.autoload_once_paths.freeze
|
|
@@ -21,7 +21,7 @@ module Rails
|
|
|
21
21
|
:read_encrypted_secrets, :log_level, :content_security_policy_report_only,
|
|
22
22
|
:content_security_policy_nonce_generator, :content_security_policy_nonce_directives,
|
|
23
23
|
:require_master_key, :credentials, :disable_sandbox, :add_autoload_paths_to_load_path,
|
|
24
|
-
:rake_eager_load
|
|
24
|
+
:rake_eager_load, :server_timing
|
|
25
25
|
|
|
26
26
|
attr_reader :encoding, :api_only, :loaded_config_version
|
|
27
27
|
|
|
@@ -74,6 +74,7 @@ module Rails
|
|
|
74
74
|
@add_autoload_paths_to_load_path = true
|
|
75
75
|
@permissions_policy = nil
|
|
76
76
|
@rake_eager_load = false
|
|
77
|
+
@server_timing = false
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
# Loads default configurations. See {the result of the method for each version}[https://guides.rubyonrails.org/configuring.html#results-of-config-load-defaults].
|
|
@@ -160,7 +161,6 @@ module Rails
|
|
|
160
161
|
|
|
161
162
|
if respond_to?(:active_job)
|
|
162
163
|
active_job.retry_jitter = 0.15
|
|
163
|
-
active_job.skip_after_callbacks_if_terminated = true
|
|
164
164
|
end
|
|
165
165
|
|
|
166
166
|
if respond_to?(:action_dispatch)
|
|
@@ -198,14 +198,18 @@ module Rails
|
|
|
198
198
|
load_defaults "6.1"
|
|
199
199
|
|
|
200
200
|
if respond_to?(:action_dispatch)
|
|
201
|
+
action_dispatch.default_headers = {
|
|
202
|
+
"X-Frame-Options" => "SAMEORIGIN",
|
|
203
|
+
"X-XSS-Protection" => "0",
|
|
204
|
+
"X-Content-Type-Options" => "nosniff",
|
|
205
|
+
"X-Download-Options" => "noopen",
|
|
206
|
+
"X-Permitted-Cross-Domain-Policies" => "none",
|
|
207
|
+
"Referrer-Policy" => "strict-origin-when-cross-origin"
|
|
208
|
+
}
|
|
201
209
|
action_dispatch.return_only_request_media_type_on_content_type = false
|
|
202
210
|
action_dispatch.cookies_serializer = :json
|
|
203
211
|
end
|
|
204
212
|
|
|
205
|
-
if respond_to?(:action_controller)
|
|
206
|
-
action_controller.silence_disabled_session_errors = false
|
|
207
|
-
end
|
|
208
|
-
|
|
209
213
|
if respond_to?(:action_view)
|
|
210
214
|
action_view.button_to_generates_button_tag = true
|
|
211
215
|
action_view.apply_stylesheet_media_default = false
|
|
@@ -216,6 +220,10 @@ module Rails
|
|
|
216
220
|
active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
|
|
217
221
|
active_support.remove_deprecated_time_with_zone_name = true
|
|
218
222
|
active_support.cache_format_version = 7.0
|
|
223
|
+
active_support.use_rfc4122_namespaced_uuids = true
|
|
224
|
+
active_support.executor_around_test_case = true
|
|
225
|
+
active_support.isolation_level = :thread
|
|
226
|
+
active_support.disable_to_s_conversion = true
|
|
219
227
|
end
|
|
220
228
|
|
|
221
229
|
if respond_to?(:action_mailer)
|
|
@@ -233,10 +241,13 @@ module Rails
|
|
|
233
241
|
if respond_to?(:active_record)
|
|
234
242
|
active_record.verify_foreign_keys_for_fixtures = true
|
|
235
243
|
active_record.partial_inserts = false
|
|
244
|
+
active_record.automatic_scope_inversing = true
|
|
236
245
|
end
|
|
237
246
|
|
|
238
247
|
if respond_to?(:action_controller)
|
|
239
248
|
action_controller.raise_on_open_redirects = true
|
|
249
|
+
|
|
250
|
+
action_controller.wrap_parameters_by_default = true
|
|
240
251
|
end
|
|
241
252
|
else
|
|
242
253
|
raise "Unknown version #{target_version.to_s.inspect}"
|
|
@@ -13,7 +13,7 @@ module Rails
|
|
|
13
13
|
|
|
14
14
|
def build_stack
|
|
15
15
|
ActionDispatch::MiddlewareStack.new do |middleware|
|
|
16
|
-
middleware.use ::ActionDispatch::HostAuthorization, config.hosts,
|
|
16
|
+
middleware.use ::ActionDispatch::HostAuthorization, config.hosts, **config.host_authorization
|
|
17
17
|
|
|
18
18
|
if config.force_ssl
|
|
19
19
|
middleware.use ::ActionDispatch::SSL, **config.ssl_options,
|
|
@@ -42,6 +42,7 @@ module Rails
|
|
|
42
42
|
|
|
43
43
|
middleware.use ::ActionDispatch::Executor, app.executor
|
|
44
44
|
|
|
45
|
+
middleware.use ::ActionDispatch::ServerTiming if config.server_timing
|
|
45
46
|
middleware.use ::Rack::Runtime
|
|
46
47
|
middleware.use ::Rack::MethodOverride unless config.api_only
|
|
47
48
|
middleware.use ::ActionDispatch::RequestId, header: config.action_dispatch.request_id_header
|
|
@@ -176,9 +176,7 @@ module Rails
|
|
|
176
176
|
initializer :set_clear_dependencies_hook, group: :all do |app|
|
|
177
177
|
callback = lambda do
|
|
178
178
|
# Order matters.
|
|
179
|
-
ActiveSupport::DescendantsTracker.clear(
|
|
180
|
-
only: ActiveSupport::Dependencies._autoloaded_tracked_classes
|
|
181
|
-
)
|
|
179
|
+
ActiveSupport::DescendantsTracker.clear(ActiveSupport::Dependencies._autoloaded_tracked_classes)
|
|
182
180
|
ActiveSupport::Dependencies.clear
|
|
183
181
|
end
|
|
184
182
|
|
|
@@ -194,6 +192,7 @@ module Rails
|
|
|
194
192
|
|
|
195
193
|
if config.cache_classes
|
|
196
194
|
# No reloader
|
|
195
|
+
ActiveSupport::DescendantsTracker.disable_clear!
|
|
197
196
|
elsif config.reload_classes_only_on_change
|
|
198
197
|
reloader = config.file_watcher.new(*watchable_args, &callback)
|
|
199
198
|
reloaders << reloader
|
|
@@ -44,7 +44,7 @@ module Rails
|
|
|
44
44
|
exclude: ["assets", javascript_path]
|
|
45
45
|
paths.add "app/assets", glob: "*"
|
|
46
46
|
paths.add "app/controllers", eager_load: true
|
|
47
|
-
paths.add "app/channels", eager_load: true
|
|
47
|
+
paths.add "app/channels", eager_load: true
|
|
48
48
|
paths.add "app/helpers", eager_load: true
|
|
49
49
|
paths.add "app/models", eager_load: true
|
|
50
50
|
paths.add "app/mailers", eager_load: true
|
data/lib/rails/engine.rb
CHANGED
|
@@ -570,14 +570,12 @@ module Rails
|
|
|
570
570
|
$LOAD_PATH.uniq!
|
|
571
571
|
end
|
|
572
572
|
|
|
573
|
-
initializer :
|
|
574
|
-
|
|
573
|
+
initializer :set_autoload_paths, before: :bootstrap_hook do
|
|
574
|
+
ActiveSupport::Dependencies.autoload_paths.unshift(*_all_autoload_paths)
|
|
575
575
|
ActiveSupport::Dependencies.autoload_once_paths.unshift(*_all_autoload_once_paths)
|
|
576
|
-
end
|
|
577
576
|
|
|
578
|
-
initializer :set_autoload_paths, before: :setup_main_autoloader do
|
|
579
577
|
config.autoload_paths.freeze
|
|
580
|
-
|
|
578
|
+
config.autoload_once_paths.freeze
|
|
581
579
|
end
|
|
582
580
|
|
|
583
581
|
initializer :set_eager_load_paths, before: :bootstrap_hook do
|
data/lib/rails/gem_version.rb
CHANGED
|
@@ -58,8 +58,10 @@ module Rails
|
|
|
58
58
|
class_option :skip_action_cable, type: :boolean, aliases: "-C", default: false,
|
|
59
59
|
desc: "Skip Action Cable files"
|
|
60
60
|
|
|
61
|
-
class_option :
|
|
62
|
-
|
|
61
|
+
class_option :skip_asset_pipeline, type: :boolean, aliases: "-A", default: false
|
|
62
|
+
|
|
63
|
+
class_option :asset_pipeline, type: :string, aliases: "-a", default: "sprockets",
|
|
64
|
+
desc: "Choose your asset pipeline [options: sprockets (default), propshaft]"
|
|
63
65
|
|
|
64
66
|
class_option :skip_javascript, type: :boolean, aliases: "-J", default: name == "plugin",
|
|
65
67
|
desc: "Skip JavaScript files"
|
|
@@ -106,6 +108,7 @@ module Rails
|
|
|
106
108
|
private
|
|
107
109
|
def gemfile_entries # :doc:
|
|
108
110
|
[rails_gemfile_entry,
|
|
111
|
+
asset_pipeline_gemfile_entry,
|
|
109
112
|
database_gemfile_entry,
|
|
110
113
|
web_server_gemfile_entry,
|
|
111
114
|
javascript_gemfile_entry,
|
|
@@ -148,7 +151,7 @@ module Rails
|
|
|
148
151
|
when /^https?:\/\//
|
|
149
152
|
options[:template]
|
|
150
153
|
when String
|
|
151
|
-
File.expand_path(options[:template]
|
|
154
|
+
File.expand_path(`echo #{options[:template]}`.strip)
|
|
152
155
|
else
|
|
153
156
|
options[:template]
|
|
154
157
|
end
|
|
@@ -165,13 +168,25 @@ module Rails
|
|
|
165
168
|
GemfileEntry.new "puma", "~> 5.0", "Use the Puma web server [https://github.com/puma/puma]"
|
|
166
169
|
end
|
|
167
170
|
|
|
171
|
+
def asset_pipeline_gemfile_entry
|
|
172
|
+
return [] if options[:skip_asset_pipeline]
|
|
173
|
+
|
|
174
|
+
if options[:asset_pipeline] == "sprockets"
|
|
175
|
+
GemfileEntry.version "sprockets-rails", ">= 3.4.1",
|
|
176
|
+
"The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]"
|
|
177
|
+
elsif options[:asset_pipeline] == "propshaft"
|
|
178
|
+
GemfileEntry.version "propshaft", ">= 0.4.1", "The modern asset pipeline for Rails [https://github.com/rails/propshaft/]"
|
|
179
|
+
else
|
|
180
|
+
[]
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
168
184
|
def include_all_railties? # :doc:
|
|
169
185
|
[
|
|
170
186
|
options.values_at(
|
|
171
187
|
:skip_active_record,
|
|
172
188
|
:skip_action_mailer,
|
|
173
189
|
:skip_test,
|
|
174
|
-
:skip_sprockets,
|
|
175
190
|
:skip_action_cable,
|
|
176
191
|
:skip_active_job
|
|
177
192
|
),
|
|
@@ -218,6 +233,11 @@ module Rails
|
|
|
218
233
|
options[:skip_dev_gems]
|
|
219
234
|
end
|
|
220
235
|
|
|
236
|
+
def skip_sprockets?
|
|
237
|
+
options[:skip_asset_pipeline] || options[:asset_pipeline] != "sprockets"
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
|
|
221
241
|
class GemfileEntry < Struct.new(:name, :version, :comment, :options, :commented_out)
|
|
222
242
|
def initialize(name, version, comment, options = {}, commented_out = false)
|
|
223
243
|
super
|
|
@@ -287,16 +307,16 @@ module Rails
|
|
|
287
307
|
def jbuilder_gemfile_entry
|
|
288
308
|
return [] if options[:skip_jbuilder]
|
|
289
309
|
comment = "Build JSON APIs with ease [https://github.com/rails/jbuilder]"
|
|
290
|
-
GemfileEntry.new "jbuilder", "~> 2.
|
|
310
|
+
GemfileEntry.new "jbuilder", "~> 2.11", comment, {}, options[:api]
|
|
291
311
|
end
|
|
292
312
|
|
|
293
313
|
def javascript_gemfile_entry
|
|
294
314
|
return [] if options[:skip_javascript]
|
|
295
315
|
|
|
296
|
-
if
|
|
297
|
-
GemfileEntry.version("importmap-rails", ">= 0.
|
|
316
|
+
if adjusted_javascript_option == "importmap"
|
|
317
|
+
GemfileEntry.version("importmap-rails", ">= 0.9.2", "Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]")
|
|
298
318
|
else
|
|
299
|
-
GemfileEntry.version "jsbundling-rails", "
|
|
319
|
+
GemfileEntry.version "jsbundling-rails", ">= 0.2.2", "Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]"
|
|
300
320
|
end
|
|
301
321
|
end
|
|
302
322
|
|
|
@@ -304,10 +324,10 @@ module Rails
|
|
|
304
324
|
return [] if options[:skip_javascript] || options[:skip_hotwire]
|
|
305
325
|
|
|
306
326
|
turbo_rails_entry =
|
|
307
|
-
GemfileEntry.version("turbo-rails", ">= 0.
|
|
327
|
+
GemfileEntry.version("turbo-rails", ">= 0.9.0", "Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]")
|
|
308
328
|
|
|
309
329
|
stimulus_rails_entry =
|
|
310
|
-
GemfileEntry.version("stimulus-rails", ">= 0.
|
|
330
|
+
GemfileEntry.version("stimulus-rails", ">= 0.7.3", "Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]")
|
|
311
331
|
|
|
312
332
|
[ turbo_rails_entry, stimulus_rails_entry ]
|
|
313
333
|
end
|
|
@@ -316,13 +336,23 @@ module Rails
|
|
|
316
336
|
options[:javascript] && options[:javascript] != "importmap"
|
|
317
337
|
end
|
|
318
338
|
|
|
339
|
+
# CSS processors other than Tailwind require a node-based JavaScript environment. So overwrite the normal JS default
|
|
340
|
+
# if one such processor has been specified.
|
|
341
|
+
def adjusted_javascript_option
|
|
342
|
+
if options[:css] && options[:css] != "tailwind" && options[:javascript] == "importmap"
|
|
343
|
+
"esbuild"
|
|
344
|
+
else
|
|
345
|
+
options[:javascript]
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
|
|
319
349
|
def css_gemfile_entry
|
|
320
350
|
return [] unless options[:css]
|
|
321
351
|
|
|
322
352
|
if !using_node? && options[:css] == "tailwind"
|
|
323
|
-
GemfileEntry.version("tailwindcss-rails", ">= 0.
|
|
353
|
+
GemfileEntry.version("tailwindcss-rails", ">= 0.5.3", "Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]")
|
|
324
354
|
else
|
|
325
|
-
GemfileEntry.version("cssbundling-rails", ">= 0.
|
|
355
|
+
GemfileEntry.version("cssbundling-rails", ">= 0.2.7", "Bundle and process CSS [https://github.com/rails/cssbundling-rails]")
|
|
326
356
|
end
|
|
327
357
|
end
|
|
328
358
|
|
|
@@ -387,9 +417,9 @@ module Rails
|
|
|
387
417
|
def run_javascript
|
|
388
418
|
return if options[:skip_javascript] || !bundle_install?
|
|
389
419
|
|
|
390
|
-
case
|
|
420
|
+
case adjusted_javascript_option
|
|
391
421
|
when "importmap" then rails_command "importmap:install"
|
|
392
|
-
when "webpack", "esbuild", "rollup" then rails_command "javascript:install:#{
|
|
422
|
+
when "webpack", "esbuild", "rollup" then rails_command "javascript:install:#{adjusted_javascript_option}"
|
|
393
423
|
end
|
|
394
424
|
end
|
|
395
425
|
|
|
@@ -22,7 +22,7 @@ module Erb # :nodoc:
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
template "partial.html.erb", File.join("app/views", controller_file_path, "_#{
|
|
25
|
+
template "partial.html.erb", File.join("app/views", controller_file_path, "_#{singular_name}.html.erb")
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
private
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%%= form_with(model: <%= model_resource_name %>) do |form| %>
|
|
2
2
|
<%% if <%= singular_table_name %>.errors.any? %>
|
|
3
|
-
<div
|
|
3
|
+
<div style="color: red">
|
|
4
4
|
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
|
5
5
|
|
|
6
6
|
<ul>
|
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
<%% end %>
|
|
13
13
|
|
|
14
14
|
<% attributes.each do |attribute| -%>
|
|
15
|
-
<div
|
|
15
|
+
<div>
|
|
16
16
|
<% if attribute.password_digest? -%>
|
|
17
|
-
<%%= form.label :password %>
|
|
17
|
+
<%%= form.label :password, style: "display: block" %>
|
|
18
18
|
<%%= form.password_field :password %>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
<div
|
|
22
|
-
<%%= form.label :password_confirmation %>
|
|
21
|
+
<div>
|
|
22
|
+
<%%= form.label :password_confirmation, style: "display: block" %>
|
|
23
23
|
<%%= form.password_field :password_confirmation %>
|
|
24
24
|
<% elsif attribute.attachments? -%>
|
|
25
|
-
<%%= form.label :<%= attribute.column_name
|
|
25
|
+
<%%= form.label :<%= attribute.column_name %>, style: "display: block" %>
|
|
26
26
|
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true %>
|
|
27
27
|
<% else -%>
|
|
28
|
-
<%%= form.label :<%= attribute.column_name
|
|
28
|
+
<%%= form.label :<%= attribute.column_name %>, style: "display: block" %>
|
|
29
29
|
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
|
|
30
30
|
<% end -%>
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
33
|
<% end -%>
|
|
34
|
-
<div
|
|
34
|
+
<div>
|
|
35
35
|
<%%= form.submit %>
|
|
36
36
|
</div>
|
|
37
37
|
<%% end %>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<div id="<%%= dom_id <%=
|
|
1
|
+
<div id="<%%= dom_id <%= singular_name %> %>">
|
|
2
2
|
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
|
3
3
|
<p>
|
|
4
4
|
<strong><%= attribute.human_name %>:</strong>
|
|
5
5
|
<% if attribute.attachment? -%>
|
|
6
|
-
<%%= link_to <%=
|
|
6
|
+
<%%= link_to <%= singular_name %>.<%= attribute.column_name %>.filename, <%= singular_name %>.<%= attribute.column_name %> if <%= singular_name %>.<%= attribute.column_name %>.attached? %>
|
|
7
7
|
<% elsif attribute.attachments? -%>
|
|
8
|
-
<%% <%=
|
|
8
|
+
<%% <%= singular_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
|
|
9
9
|
<div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
|
|
10
10
|
<%% end %>
|
|
11
11
|
<% else -%>
|
|
12
|
-
<%%= <%=
|
|
12
|
+
<%%= <%= singular_name %>.<%= attribute.column_name %> %>
|
|
13
13
|
<% end -%>
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<% end -%>
|
|
17
17
|
<p>
|
|
18
|
-
<%%= link_to "Show this <%= human_name.downcase %>", <%=
|
|
18
|
+
<%%= link_to "Show this <%= human_name.downcase %>", <%= singular_name %> %>
|
|
19
19
|
</p>
|
|
20
20
|
</div>
|
|
@@ -106,9 +106,9 @@ module Rails
|
|
|
106
106
|
@field_type ||= case type
|
|
107
107
|
when :integer then :number_field
|
|
108
108
|
when :float, :decimal then :text_field
|
|
109
|
-
when :time then :
|
|
110
|
-
when :datetime, :timestamp then :
|
|
111
|
-
when :date then :
|
|
109
|
+
when :time then :time_field
|
|
110
|
+
when :datetime, :timestamp then :datetime_field
|
|
111
|
+
when :date then :date_field
|
|
112
112
|
when :text then :text_area
|
|
113
113
|
when :rich_text then :rich_text_area
|
|
114
114
|
when :boolean then :check_box
|
|
@@ -123,8 +123,8 @@ module Rails
|
|
|
123
123
|
when :integer then 1
|
|
124
124
|
when :float then 1.5
|
|
125
125
|
when :decimal then "9.99"
|
|
126
|
-
when :datetime, :timestamp, :time then Time.now.
|
|
127
|
-
when :date then Date.today.
|
|
126
|
+
when :datetime, :timestamp, :time then Time.now.to_formatted_s(:db)
|
|
127
|
+
when :date then Date.today.to_formatted_s(:db)
|
|
128
128
|
when :string then name == "type" ? "" : "MyString"
|
|
129
129
|
when :text then "MyText"
|
|
130
130
|
when :boolean then false
|
|
@@ -138,15 +138,15 @@ module Rails
|
|
|
138
138
|
template "config/storage.yml"
|
|
139
139
|
end
|
|
140
140
|
|
|
141
|
-
if
|
|
141
|
+
if skip_sprockets? && !assets_config_exist
|
|
142
142
|
remove_file "config/initializers/assets.rb"
|
|
143
143
|
end
|
|
144
144
|
|
|
145
|
-
if
|
|
145
|
+
if skip_sprockets? && !asset_manifest_exist
|
|
146
146
|
remove_file "app/assets/config/manifest.js"
|
|
147
147
|
end
|
|
148
148
|
|
|
149
|
-
if
|
|
149
|
+
if skip_sprockets? && !asset_app_stylesheet_exist
|
|
150
150
|
remove_file "app/assets/stylesheets/application.css"
|
|
151
151
|
end
|
|
152
152
|
|
|
@@ -163,6 +163,10 @@ module Rails
|
|
|
163
163
|
remove_file "config/initializers/permissions_policy.rb"
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
|
+
|
|
167
|
+
if !skip_sprockets?
|
|
168
|
+
insert_into_file "config/application.rb", %(require "sprockets/railtie"), after: /require\(["']rails\/all["']\)\n/
|
|
169
|
+
end
|
|
166
170
|
end
|
|
167
171
|
|
|
168
172
|
def master_key
|
|
@@ -262,7 +266,7 @@ module Rails
|
|
|
262
266
|
class_option :api, type: :boolean, desc: "Preconfigure smaller stack for API only apps"
|
|
263
267
|
class_option :minimal, type: :boolean, desc: "Preconfigure a minimal rails app"
|
|
264
268
|
class_option :javascript, type: :string, aliases: "-j", default: "importmap", desc: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
|
|
265
|
-
class_option :css, type: :string, desc: "Choose CSS processor [options: tailwind, postcss, sass]"
|
|
269
|
+
class_option :css, type: :string, aliases: "-c", desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
|
|
266
270
|
class_option :skip_bundle, type: :boolean, aliases: "-B", default: false, desc: "Don't run bundle install"
|
|
267
271
|
|
|
268
272
|
def initialize(*args)
|
|
@@ -275,7 +279,7 @@ module Rails
|
|
|
275
279
|
# Force sprockets and JavaScript to be skipped when generating API only apps.
|
|
276
280
|
# Can't modify options hash as it's frozen by default.
|
|
277
281
|
if options[:api]
|
|
278
|
-
self.options = options.merge(
|
|
282
|
+
self.options = options.merge(skip_asset_pipeline: true, skip_javascript: true).freeze
|
|
279
283
|
end
|
|
280
284
|
|
|
281
285
|
if options[:minimal]
|
|
@@ -440,10 +444,12 @@ module Rails
|
|
|
440
444
|
end
|
|
441
445
|
|
|
442
446
|
def delete_assets_initializer_skipping_sprockets
|
|
443
|
-
if
|
|
447
|
+
if skip_sprockets?
|
|
444
448
|
remove_file "config/initializers/assets.rb"
|
|
445
449
|
remove_file "app/assets/config/manifest.js"
|
|
450
|
+
remove_dir "app/assets/config"
|
|
446
451
|
remove_file "app/assets/stylesheets/application.css"
|
|
452
|
+
create_file "app/assets/stylesheets/application.css", "/* Application styles */\n" unless options[:api]
|
|
447
453
|
end
|
|
448
454
|
end
|
|
449
455
|
|
|
@@ -10,18 +10,23 @@ ruby <%= "\"#{RUBY_VERSION}\"" -%>
|
|
|
10
10
|
<%= gem.commented_out ? "# " : "" %>gem "<%= gem.name %>"<%= %(, "#{gem.version}") if gem.version -%>
|
|
11
11
|
<% if gem.options.any? -%>, <%= gem.options.map { |k,v| "#{k}: #{v.inspect}" }.join(", ") %><% end -%>
|
|
12
12
|
<% end %>
|
|
13
|
+
<% unless options.minimal? -%>
|
|
14
|
+
|
|
15
|
+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
|
16
|
+
# gem "kredis"
|
|
17
|
+
|
|
18
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
19
|
+
# gem "bcrypt", "~> 3.1.7"
|
|
20
|
+
<% end -%>
|
|
13
21
|
|
|
14
22
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
|
15
23
|
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
|
|
16
|
-
|
|
17
24
|
<% if depend_on_bootsnap? -%>
|
|
25
|
+
|
|
18
26
|
# Reduces boot times through caching; required in config/boot.rb
|
|
19
27
|
gem "bootsnap", ">= 1.4.4", require: false
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
|
23
|
-
# gem "bcrypt", "~> 3.1.7"
|
|
24
|
-
<% unless options.skip_sprockets? || options.minimal? -%>
|
|
28
|
+
<% end -%>
|
|
29
|
+
<% unless skip_sprockets? || options.minimal? -%>
|
|
25
30
|
|
|
26
31
|
# Use Sass to process CSS
|
|
27
32
|
# gem "sassc-rails", "~> 2.1"
|
|
@@ -39,7 +44,7 @@ gem "bootsnap", ">= 1.4.4", require: false
|
|
|
39
44
|
<% if RUBY_ENGINE == "ruby" -%>
|
|
40
45
|
|
|
41
46
|
group :development, :test do
|
|
42
|
-
#
|
|
47
|
+
# See https://edgeguides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
|
43
48
|
gem "debug", ">= 1.0.0", platforms: %i[ mri mingw x64_mingw ]
|
|
44
49
|
end
|
|
45
50
|
<% end -%>
|
|
@@ -61,7 +66,7 @@ end
|
|
|
61
66
|
group :test do
|
|
62
67
|
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
|
63
68
|
gem "capybara", ">= 3.26"
|
|
64
|
-
gem "selenium-webdriver"
|
|
69
|
+
gem "selenium-webdriver", ">= 4.0.0"
|
|
65
70
|
gem "webdrivers"
|
|
66
71
|
end
|
|
67
|
-
<%- end -%>
|
|
72
|
+
<%- end -%>
|
|
@@ -15,7 +15,6 @@ require "action_controller/railtie"
|
|
|
15
15
|
<%= comment_if :skip_action_text %>require "action_text/engine"
|
|
16
16
|
require "action_view/railtie"
|
|
17
17
|
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
|
18
|
-
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
|
19
18
|
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
|
20
19
|
<% end -%>
|
|
21
20
|
|
|
@@ -14,6 +14,9 @@ Rails.application.configure do
|
|
|
14
14
|
# Show full error reports.
|
|
15
15
|
config.consider_all_requests_local = true
|
|
16
16
|
|
|
17
|
+
# Enable server timing
|
|
18
|
+
config.server_timing = true
|
|
19
|
+
|
|
17
20
|
# Enable/disable caching. By default caching is disabled.
|
|
18
21
|
# Run rails dev:cache to toggle caching.
|
|
19
22
|
if Rails.root.join("tmp/caching-dev.txt").exist?
|
|
@@ -61,7 +64,7 @@ Rails.application.configure do
|
|
|
61
64
|
config.active_record.verbose_query_logs = true
|
|
62
65
|
|
|
63
66
|
<%- end -%>
|
|
64
|
-
<%- unless
|
|
67
|
+
<%- unless skip_sprockets? -%>
|
|
65
68
|
# Suppress logger output for asset requests.
|
|
66
69
|
config.assets.quiet = true
|
|
67
70
|
<%- end -%>
|
|
@@ -26,7 +26,7 @@ Rails.application.configure do
|
|
|
26
26
|
# Apache or NGINX already handles this.
|
|
27
27
|
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
|
28
28
|
|
|
29
|
-
<%- unless
|
|
29
|
+
<%- unless skip_sprockets? -%>
|
|
30
30
|
# Compress CSS using a preprocessor.
|
|
31
31
|
# config.assets.css_compressor = :sass
|
|
32
32
|
|
|
@@ -70,8 +70,8 @@ Rails.application.configure do
|
|
|
70
70
|
# Use a real queuing backend for Active Job (and separate queues per environment).
|
|
71
71
|
# config.active_job.queue_adapter = :resque
|
|
72
72
|
# config.active_job.queue_name_prefix = "<%= app_name %>_production"
|
|
73
|
-
<%- end -%>
|
|
74
73
|
|
|
74
|
+
<%- end -%>
|
|
75
75
|
<%- unless options.skip_action_mailer? -%>
|
|
76
76
|
config.action_mailer.perform_caching = false
|
|
77
77
|
|
|
@@ -125,4 +125,14 @@ Rails.application.configure do
|
|
|
125
125
|
# config.active_record.database_selector = { delay: 2.seconds }
|
|
126
126
|
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
|
127
127
|
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
|
128
|
+
|
|
129
|
+
# Inserts middleware to perform automatic shard swapping. The `shard_selector` hash
|
|
130
|
+
# can be used to pass options to the `ShardSelector` middleware. The `lock` option is
|
|
131
|
+
# used to determine whether shard swapping should be prohibited for the request.
|
|
132
|
+
#
|
|
133
|
+
# The `shard_resolver` option is used by the middleware to determine which shard
|
|
134
|
+
# to switch to. The application must provide a mechanism for finding the shard name
|
|
135
|
+
# in a proc. See guides for an example.
|
|
136
|
+
# config.active_record.shard_selector = { lock: true }
|
|
137
|
+
# config.active_record.shard_resolver = ->(request) { Tenant.find_by!(host: request.host).shard }
|
|
128
138
|
end
|
|
@@ -11,10 +11,10 @@ Rails.application.configure do
|
|
|
11
11
|
# Turn false under Spring and add config.action_view.cache_template_loading = true
|
|
12
12
|
config.cache_classes = true
|
|
13
13
|
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
config.eager_load =
|
|
14
|
+
# Eager loading loads your whole application. When running a single test locally,
|
|
15
|
+
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
|
16
|
+
# system, or in some way before deploying your code.
|
|
17
|
+
config.eager_load = ENV["CI"].present?
|
|
18
18
|
|
|
19
19
|
# Configure public file server for tests with Cache-Control for performance.
|
|
20
20
|
config.public_file_server.enabled = true
|
data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
CHANGED
|
@@ -4,24 +4,23 @@
|
|
|
4
4
|
# For further information see the following documentation
|
|
5
5
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
|
6
6
|
|
|
7
|
-
# Rails.application.
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
7
|
+
# Rails.application.configure do
|
|
8
|
+
# config.content_security_policy do |policy|
|
|
9
|
+
# policy.default_src :self, :https
|
|
10
|
+
# policy.font_src :self, :https, :data
|
|
11
|
+
# policy.img_src :self, :https, :data
|
|
12
|
+
# policy.object_src :none
|
|
13
|
+
# policy.script_src :self, :https
|
|
14
|
+
# policy.style_src :self, :https
|
|
15
|
+
# # Specify URI for violation reports
|
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# # Generate session nonces for permitted importmap and inline scripts
|
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src)
|
|
22
|
+
#
|
|
23
|
+
# # Report CSP violations to a specified URI. See:
|
|
24
|
+
# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
|
25
|
+
# # config.content_security_policy_report_only = true
|
|
16
26
|
# end
|
|
17
|
-
|
|
18
|
-
# If you are using UJS then enable automatic nonce generation
|
|
19
|
-
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
|
20
|
-
|
|
21
|
-
# Set the nonce only to specific directives
|
|
22
|
-
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
|
23
|
-
|
|
24
|
-
# Report CSP violations to a specified URI
|
|
25
|
-
# For further information see the following documentation:
|
|
26
|
-
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
|
27
|
-
# Rails.application.config.content_security_policy_report_only = true
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt
CHANGED
|
@@ -45,6 +45,17 @@
|
|
|
45
45
|
# and you have no plans to rollback.
|
|
46
46
|
# Rails.application.config.active_support.cache_format_version = 7.0
|
|
47
47
|
|
|
48
|
+
# Calls `Rails.application.executor.wrap` around test cases.
|
|
49
|
+
# This makes test cases behave closer to an actual request or job.
|
|
50
|
+
# Several features that are normally disabled in test, such as Active Record query cache
|
|
51
|
+
# and asynchronous queries will then be enabled.
|
|
52
|
+
# Rails.application.config.active_support.executor_around_test_case = true
|
|
53
|
+
|
|
54
|
+
# Define the isolation level of most of Rails internal state.
|
|
55
|
+
# If you use a fiber based server or job processor, you should set it to `:fiber`.
|
|
56
|
+
# Otherwise the default of `:thread` if preferable.
|
|
57
|
+
# Rails.application.config.active_support.isolation_level = :thread
|
|
58
|
+
|
|
48
59
|
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
|
|
49
60
|
# Rails.application.config.action_mailer.smtp_timeout = 5
|
|
50
61
|
|
|
@@ -54,6 +65,9 @@
|
|
|
54
65
|
# Rails.application.config.active_storage.video_preview_arguments =
|
|
55
66
|
# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
|
|
56
67
|
|
|
68
|
+
# Automatically infer `inverse_of` for associations with a scope.
|
|
69
|
+
# Rails.application.config.active_record.automatic_scope_inversing = true
|
|
70
|
+
|
|
57
71
|
# Raise when running tests if fixtures contained foreign key violations
|
|
58
72
|
# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
|
|
59
73
|
|
|
@@ -83,3 +97,25 @@
|
|
|
83
97
|
#
|
|
84
98
|
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
|
|
85
99
|
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
|
|
100
|
+
|
|
101
|
+
# Enable parameter wrapping for JSON.
|
|
102
|
+
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
|
|
103
|
+
# To disable parameter wrapping entirely, set this config to `false`.
|
|
104
|
+
# Rails.application.config.action_controller.wrap_parameters_by_default = true
|
|
105
|
+
|
|
106
|
+
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
|
|
107
|
+
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
|
|
108
|
+
#
|
|
109
|
+
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
|
|
110
|
+
# more information.
|
|
111
|
+
# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
|
|
112
|
+
|
|
113
|
+
# Change the default headers to disable browsers' flawed legacy XSS protection.
|
|
114
|
+
# Rails.application.config.action_dispatch.default_headers = {
|
|
115
|
+
# "X-Frame-Options" => "SAMEORIGIN",
|
|
116
|
+
# "X-XSS-Protection" => "0",
|
|
117
|
+
# "X-Content-Type-Options" => "nosniff",
|
|
118
|
+
# "X-Download-Options" => "noopen",
|
|
119
|
+
# "X-Permitted-Cross-Domain-Policies" => "none",
|
|
120
|
+
# "Referrer-Policy" => "strict-origin-when-cross-origin"
|
|
121
|
+
# }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Rails.application.routes.draw do
|
|
2
|
-
#
|
|
2
|
+
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
3
3
|
|
|
4
|
-
#
|
|
4
|
+
# Defines the root path route ("/")
|
|
5
5
|
# root "articles#index"
|
|
6
6
|
end
|
|
@@ -316,7 +316,7 @@ module Rails
|
|
|
316
316
|
mute do
|
|
317
317
|
build(:generate_test_dummy)
|
|
318
318
|
build(:test_dummy_config)
|
|
319
|
-
build(:test_dummy_sprocket_assets) unless
|
|
319
|
+
build(:test_dummy_sprocket_assets) unless skip_sprockets?
|
|
320
320
|
build(:test_dummy_clean)
|
|
321
321
|
# ensure that bin/rails has proper dummy_path
|
|
322
322
|
build(:bin, true)
|
|
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
|
|
|
20
20
|
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
|
21
21
|
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
22
22
|
|
|
23
|
-
spec.files = Dir
|
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
24
|
+
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
|
|
25
|
+
end
|
|
24
26
|
|
|
25
27
|
<%= "# " if options.dev? || options.edge? || options.main? -%>spec.add_dependency "rails", "<%= Array(rails_version_specifier).join('", "') %>"
|
|
26
28
|
end
|
|
@@ -24,7 +24,6 @@ require "action_controller/railtie"
|
|
|
24
24
|
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
|
|
25
25
|
require "action_view/railtie"
|
|
26
26
|
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
|
27
|
-
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
|
28
27
|
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
|
29
28
|
<% end -%>
|
|
30
29
|
require "rails/engine/commands"
|
|
@@ -8,12 +8,12 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
|
|
|
8
8
|
|
|
9
9
|
test "visiting the index" do
|
|
10
10
|
visit <%= plural_table_name %>_url
|
|
11
|
-
assert_selector "h1", text: "<%=
|
|
11
|
+
assert_selector "h1", text: "<%= human_name.pluralize %>"
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
test "should create <%= human_name %>" do
|
|
14
|
+
test "should create <%= human_name.downcase %>" do
|
|
15
15
|
visit <%= plural_table_name %>_url
|
|
16
|
-
click_on "New <%=
|
|
16
|
+
click_on "New <%= human_name.downcase %>"
|
|
17
17
|
|
|
18
18
|
<%- attributes_hash.each do |attr, value| -%>
|
|
19
19
|
<%- if boolean?(attr) -%>
|
|
@@ -29,8 +29,8 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
test "should update <%= human_name %>" do
|
|
32
|
-
visit <%=
|
|
33
|
-
click_on "Edit", match: :first
|
|
32
|
+
visit <%= singular_table_name %>_url(@<%= singular_table_name %>)
|
|
33
|
+
click_on "Edit this <%= human_name.downcase %>", match: :first
|
|
34
34
|
|
|
35
35
|
<%- attributes_hash.each do |attr, value| -%>
|
|
36
36
|
<%- if boolean?(attr) -%>
|
|
@@ -46,10 +46,8 @@ class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
test "should destroy <%= human_name %>" do
|
|
49
|
-
visit <%=
|
|
50
|
-
|
|
51
|
-
click_on "Destroy", match: :first
|
|
52
|
-
end
|
|
49
|
+
visit <%= singular_table_name %>_url(@<%= singular_table_name %>)
|
|
50
|
+
click_on "Destroy this <%= human_name.downcase %>", match: :first
|
|
53
51
|
|
|
54
52
|
assert_text "<%= human_name %> was successfully destroyed"
|
|
55
53
|
end
|
data/lib/rails/railtie.rb
CHANGED
|
@@ -146,7 +146,7 @@ module Rails
|
|
|
146
146
|
delegate :config, to: :instance
|
|
147
147
|
|
|
148
148
|
def subclasses
|
|
149
|
-
super.reject(&:abstract_railtie?)
|
|
149
|
+
super.reject(&:abstract_railtie?).sort
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
def rake_tasks(&blk)
|
|
@@ -191,6 +191,23 @@ module Rails
|
|
|
191
191
|
instance.configure(&block)
|
|
192
192
|
end
|
|
193
193
|
|
|
194
|
+
def <=>(other) # :nodoc:
|
|
195
|
+
load_index <=> other.load_index
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def inherited(subclass)
|
|
199
|
+
subclass.increment_load_index
|
|
200
|
+
super
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
protected
|
|
204
|
+
attr_reader :load_index
|
|
205
|
+
|
|
206
|
+
def increment_load_index
|
|
207
|
+
@@load_counter ||= 0
|
|
208
|
+
@load_index = (@@load_counter += 1)
|
|
209
|
+
end
|
|
210
|
+
|
|
194
211
|
private
|
|
195
212
|
def generate_railtie_name(string)
|
|
196
213
|
ActiveSupport::Inflector.underscore(string).tr("/", "_")
|
data/lib/rails/tasks/yarn.rake
CHANGED
|
@@ -10,7 +10,7 @@ namespace :yarn do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
yarn_flags =
|
|
13
|
-
if
|
|
13
|
+
if `yarn --version`.start_with?("1")
|
|
14
14
|
"--no-progress --frozen-lockfile"
|
|
15
15
|
else
|
|
16
16
|
"--immutable"
|
|
@@ -18,17 +18,12 @@ namespace :yarn do
|
|
|
18
18
|
|
|
19
19
|
system(
|
|
20
20
|
{ "NODE_ENV" => node_env },
|
|
21
|
-
"
|
|
21
|
+
"yarn install #{yarn_flags}",
|
|
22
22
|
exception: true
|
|
23
23
|
)
|
|
24
24
|
rescue Errno::ENOENT
|
|
25
|
-
$stderr.puts "
|
|
26
|
-
$stderr.puts "
|
|
25
|
+
$stderr.puts "yarn install failed to execute."
|
|
26
|
+
$stderr.puts "Ensure yarn is installed and `yarn --version` runs without errors."
|
|
27
27
|
exit 1
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
|
-
|
|
31
|
-
# Run Yarn prior to Sprockets assets precompilation, so dependencies are available for use.
|
|
32
|
-
if Rake::Task.task_defined?("assets:precompile") && File.exist?(Rails.root.join("bin", "yarn"))
|
|
33
|
-
Rake::Task["assets:precompile"].enhance [ "yarn:install" ]
|
|
34
|
-
end
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
</header>
|
|
125
125
|
|
|
126
126
|
<% if @part && @part.mime_type %>
|
|
127
|
-
<iframe
|
|
127
|
+
<iframe name="messageBody" src="?<%= part_query(@part.mime_type) %>"></iframe>
|
|
128
128
|
<% else %>
|
|
129
129
|
<p>
|
|
130
130
|
You are trying to preview an email that does not have any content.
|
|
@@ -43,10 +43,7 @@ module Rails
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def load_tests(argv)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
tests = Rake::FileList[patterns.any? ? patterns : default_test_glob]
|
|
49
|
-
tests.exclude(default_test_exclude_glob) if patterns.empty?
|
|
46
|
+
tests = list_tests(argv)
|
|
50
47
|
tests.to_a.each { |path| require File.expand_path(path) }
|
|
51
48
|
end
|
|
52
49
|
|
|
@@ -94,6 +91,14 @@ module Rails
|
|
|
94
91
|
def path_argument?(arg)
|
|
95
92
|
%r"^[/\\]?\w+[/\\]".match?(arg)
|
|
96
93
|
end
|
|
94
|
+
|
|
95
|
+
def list_tests(argv)
|
|
96
|
+
patterns = extract_filters(argv)
|
|
97
|
+
|
|
98
|
+
tests = Rake::FileList[patterns.any? ? patterns : default_test_glob]
|
|
99
|
+
tests.exclude(default_test_exclude_glob) if patterns.empty?
|
|
100
|
+
tests
|
|
101
|
+
end
|
|
97
102
|
end
|
|
98
103
|
end
|
|
99
104
|
|
data/lib/rails.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railties
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.0.0.
|
|
4
|
+
version: 7.0.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -16,42 +16,42 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 7.0.0.
|
|
19
|
+
version: 7.0.0.rc1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 7.0.0.
|
|
26
|
+
version: 7.0.0.rc1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: actionpack
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - '='
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 7.0.0.
|
|
33
|
+
version: 7.0.0.rc1
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - '='
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 7.0.0.
|
|
40
|
+
version: 7.0.0.rc1
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rake
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '12.2'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '12.2'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: thor
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,28 +86,28 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 2.5
|
|
89
|
+
version: '2.5'
|
|
90
90
|
type: :runtime
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 2.5
|
|
96
|
+
version: '2.5'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: actionview
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - '='
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 7.0.0.
|
|
103
|
+
version: 7.0.0.rc1
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - '='
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 7.0.0.
|
|
110
|
+
version: 7.0.0.rc1
|
|
111
111
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
|
112
112
|
email: david@loudthinking.com
|
|
113
113
|
executables:
|
|
@@ -250,15 +250,12 @@ files:
|
|
|
250
250
|
- lib/rails/generators/rails/app/templates/config/environments/production.rb.tt
|
|
251
251
|
- lib/rails/generators/rails/app/templates/config/environments/test.rb.tt
|
|
252
252
|
- lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt
|
|
253
|
-
- lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt
|
|
254
253
|
- lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
|
|
255
254
|
- lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt
|
|
256
255
|
- lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
|
|
257
256
|
- lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt
|
|
258
|
-
- lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt
|
|
259
257
|
- lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt
|
|
260
258
|
- lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt
|
|
261
|
-
- lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt
|
|
262
259
|
- lib/rails/generators/rails/app/templates/config/locales/en.yml
|
|
263
260
|
- lib/rails/generators/rails/app/templates/config/puma.rb.tt
|
|
264
261
|
- lib/rails/generators/rails/app/templates/config/routes.rb.tt
|
|
@@ -425,10 +422,11 @@ licenses:
|
|
|
425
422
|
- MIT
|
|
426
423
|
metadata:
|
|
427
424
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
428
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.0.0.
|
|
429
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.0.
|
|
425
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.0.rc1/railties/CHANGELOG.md
|
|
426
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.0.rc1/
|
|
430
427
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
431
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.0.
|
|
428
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.0.rc1/railties
|
|
429
|
+
rubygems_mfa_required: 'true'
|
|
432
430
|
post_install_message:
|
|
433
431
|
rdoc_options:
|
|
434
432
|
- "--exclude"
|
|
@@ -446,7 +444,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
446
444
|
- !ruby/object:Gem::Version
|
|
447
445
|
version: 1.3.1
|
|
448
446
|
requirements: []
|
|
449
|
-
rubygems_version: 3.
|
|
447
|
+
rubygems_version: 3.2.22
|
|
450
448
|
signing_key:
|
|
451
449
|
specification_version: 4
|
|
452
450
|
summary: Tools for creating, working with, and running Rails applications.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
|
|
5
|
-
|
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
|
|
7
|
-
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
|
|
8
|
-
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
|
4
|
-
# is enabled by default.
|
|
5
|
-
|
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
|
8
|
-
wrap_parameters format: [:json]
|
|
9
|
-
end
|
|
10
|
-
<%- unless options.skip_active_record? -%>
|
|
11
|
-
|
|
12
|
-
# To enable root element in JSON for ActiveRecord objects.
|
|
13
|
-
# ActiveSupport.on_load(:active_record) do
|
|
14
|
-
# self.include_root_in_json = true
|
|
15
|
-
# end
|
|
16
|
-
<%- end -%>
|