railties 7.0.4.3 → 7.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd91d4a0d1e4fac103d10a754650b06829501e7352fd942181a307575de37d87
4
- data.tar.gz: 18dc783f7038b79b1517f3a1a62facb2aff18310a92dfb6105f98affc7b09a8b
3
+ metadata.gz: d5d76894f7ee82ab8df507eb093d755cf69c3dd1e0adb6c965865a0ea7fa1ea5
4
+ data.tar.gz: 1b8a5c3cbe5056a657f92de640b7d8db16d29b7bbc1efc226e8e37f5c0fe810d
5
5
  SHA512:
6
- metadata.gz: c9f6188e4ba22dfd566b9fa39da12e0a2fe773b5ee6f4d8e0598a41995d628ee9a671d6233d18d710161e989935446701c2c1632d5413faf9049bb9b6a11ac2c
7
- data.tar.gz: 768e9b9a6597c9e7004772465ddddf22c92c7de9f2834720a512dc2fee9af34f9b82ca9057c98f270920c7eaee6ed752bfa7478d7e49bb7f08197dd361a3b66a
6
+ metadata.gz: f6af0cb8b05213f42dc7f656d3b0df7097f39337b2cdfa3e8ee383d76ff78f21b966a180bd2459a104c32c90bfd8553a6c1b2e83c468aa9a77dc7301ddae16e0
7
+ data.tar.gz: f0e75011cf18bb845a82c80f632fa2fa40e2054e44d26659abc93b5b9938880c647dd09eaba5062391745307e64b2c2fc24603f3565e5e4b21c0edd9b8c44608
data/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## Rails 7.0.6 (June 29, 2023) ##
2
+
3
+ * Avoid escaping paths when editing credentials.
4
+
5
+ *Jonathan Hefner*
6
+
7
+
8
+ ## Rails 7.0.5.1 (June 26, 2023) ##
9
+
10
+ * No changes.
11
+
12
+
13
+ ## Rails 7.0.5 (May 24, 2023) ##
14
+
15
+ * Add puma app server to Gemfile in order to start test/dummy.
16
+
17
+ *Donapieppo*
18
+
19
+ * Rails console now disables `IRB`'s autocompletion feature in production by default.
20
+
21
+ Setting `IRB_USE_AUTOCOMPLETE=true` can override this default.
22
+
23
+ *Stan Lo*
24
+
25
+ * Send 303 See Other status code back for the destroy action on newly generated
26
+ scaffold controllers.
27
+
28
+ *Tony Drake*
29
+
30
+
1
31
  ## Rails 7.0.4.3 (March 13, 2023) ##
2
32
 
3
33
  * No changes.
data/README.rdoc CHANGED
@@ -14,7 +14,7 @@ The latest version of Railties can be installed with RubyGems:
14
14
 
15
15
  * gem install railties
16
16
 
17
- Source code can be downloaded as part of the Rails project on GitHub
17
+ Source code can be downloaded as part of the \Rails project on GitHub
18
18
 
19
19
  * https://github.com/rails/rails/tree/main/railties
20
20
 
@@ -422,44 +422,39 @@ module Rails
422
422
  end
423
423
  end
424
424
 
425
- # Decrypts the credentials hash as kept in +config/credentials.yml.enc+. This file is encrypted with
426
- # the Rails master key, which is either taken from <tt>ENV["RAILS_MASTER_KEY"]</tt> or from loading
427
- # +config/master.key+.
428
- # If specific credentials file exists for current environment, it takes precedence, thus for +production+
429
- # environment look first for +config/credentials/production.yml.enc+ with master key taken
430
- # from <tt>ENV["RAILS_MASTER_KEY"]</tt> or from loading +config/credentials/production.key+.
431
- # Default behavior can be overwritten by setting +config.credentials.content_path+ and +config.credentials.key_path+.
425
+ # Returns an ActiveSupport::EncryptedConfiguration instance for the
426
+ # credentials file specified by +config.credentials.content_path+.
427
+ #
428
+ # By default, +config.credentials.content_path+ will point to either
429
+ # <tt>config/credentials/#{environment}.yml.enc</tt> for the current
430
+ # environment (for example, +config/credentials/production.yml.enc+ for the
431
+ # +production+ environment), or +config/credentials.yml.enc+ if that file
432
+ # does not exist.
433
+ #
434
+ # The encryption key is taken from either <tt>ENV["RAILS_MASTER_KEY"]</tt>,
435
+ # or from the file specified by +config.credentials.key_path+. By default,
436
+ # +config.credentials.key_path+ will point to either
437
+ # <tt>config/credentials/#{environment}.key</tt> for the current
438
+ # environment, or +config/master.key+ if that file does not exist.
432
439
  def credentials
433
440
  @credentials ||= encrypted(config.credentials.content_path, key_path: config.credentials.key_path)
434
441
  end
435
442
 
436
- # Shorthand to decrypt any encrypted configurations or files.
437
- #
438
- # For any file added with <tt>rails encrypted:edit</tt> call +read+ to decrypt
439
- # the file with the master key.
440
- # The master key is either stored in +config/master.key+ or <tt>ENV["RAILS_MASTER_KEY"]</tt>.
441
- #
442
- # Rails.application.encrypted("config/mystery_man.txt.enc").read
443
- # # => "We've met before, haven't we?"
444
- #
445
- # It's also possible to interpret encrypted YAML files with +config+.
446
- #
447
- # Rails.application.encrypted("config/credentials.yml.enc").config
448
- # # => { next_guys_line: "I don't think so. Where was it you think we met?" }
449
- #
450
- # Any top-level configs are also accessible directly on the return value:
451
- #
452
- # Rails.application.encrypted("config/credentials.yml.enc").next_guys_line
453
- # # => "I don't think so. Where was it you think we met?"
443
+ # Returns an ActiveSupport::EncryptedConfiguration instance for an encrypted
444
+ # file. By default, the encryption key is taken from either
445
+ # <tt>ENV["RAILS_MASTER_KEY"]</tt>, or from the +config/master.key+ file.
454
446
  #
455
- # The files or configs can also be encrypted with a custom key. To decrypt with
456
- # a key in the +ENV+, use:
447
+ # my_config = Rails.application.encrypted("config/my_config.enc")
457
448
  #
458
- # Rails.application.encrypted("config/special_tokens.yml.enc", env_key: "SPECIAL_TOKENS")
449
+ # my_config.read
450
+ # # => "foo:\n bar: 123\n"
459
451
  #
460
- # Or to decrypt with a file, that should be version control ignored, relative to +Rails.root+:
452
+ # my_config.foo.bar
453
+ # # => 123
461
454
  #
462
- # Rails.application.encrypted("config/special_tokens.yml.enc", key_path: "config/special_tokens.key")
455
+ # Encrypted files can be edited with the <tt>bin/rails encrypted:edit</tt>
456
+ # command. (See the output of <tt>bin/rails encrypted:edit --help</tt> for
457
+ # more information.)
463
458
  def encrypted(path, key_path: "config/master.key", env_key: "RAILS_MASTER_KEY")
464
459
  ActiveSupport::EncryptedConfiguration.new(
465
460
  config_path: Rails.root.join(path),
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Rails::ApplicationController < ActionController::Base # :nodoc:
4
- self.view_paths = File.expand_path("templates", __dir__)
4
+ prepend_view_path File.expand_path("templates", __dir__)
5
5
  layout "application"
6
6
 
7
7
  before_action :disable_content_security_policy_nonce!
@@ -38,6 +38,10 @@ module Rails
38
38
 
39
39
  if @console == IRB
40
40
  IRB::WorkSpace.prepend(BacktraceCleaner)
41
+
42
+ if Rails.env.production?
43
+ ENV["IRB_USE_AUTOCOMPLETE"] ||= "false"
44
+ end
41
45
  end
42
46
  end
43
47
 
@@ -92,7 +92,7 @@ module Rails
92
92
 
93
93
  def change_credentials_in_system_editor
94
94
  credentials.change do |tmp_path|
95
- system("#{ENV["EDITOR"]} #{Shellwords.escape(tmp_path)}")
95
+ system(*Shellwords.split(ENV["EDITOR"]), tmp_path.to_s)
96
96
  end
97
97
  end
98
98
 
@@ -9,8 +9,8 @@ module Rails
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 4
13
- PRE = "3"
12
+ TINY = 6
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -12,13 +12,58 @@ module Rails
12
12
  @indentation = 0
13
13
  end
14
14
 
15
- # Adds an entry into +Gemfile+ for the supplied gem.
15
+ # Adds a +gem+ declaration to the +Gemfile+ for the specified gem.
16
16
  #
17
17
  # gem "rspec", group: :test
18
18
  # gem "technoweenie-restful-authentication", lib: "restful-authentication", source: "http://gems.github.com/"
19
19
  # gem "rails", "3.0", git: "https://github.com/rails/rails"
20
20
  # gem "RedCloth", ">= 4.1.0", "< 4.2.0"
21
21
  # gem "rspec", comment: "Put this comment above the gem declaration"
22
+ #
23
+ # Note that this method only adds the gem to the +Gemfile+; it does not
24
+ # install the gem.
25
+ #
26
+ # ==== Options
27
+ #
28
+ # [+:version+]
29
+ # The version constraints for the gem, specified as a string or an
30
+ # array of strings:
31
+ #
32
+ # gem "my_gem", version: "~> 1.1"
33
+ # gem "my_gem", version: [">= 1.1", "< 2.0"]
34
+ #
35
+ # Alternatively, can be specified as one or more arguments following the
36
+ # gem name:
37
+ #
38
+ # gem "my_gem", ">= 1.1", "< 2.0"
39
+ #
40
+ # [+:comment+]
41
+ # Outputs a comment above the +gem+ declaration in the +Gemfile+.
42
+ #
43
+ # gem "my_gem", comment: "First line.\nSecond line."
44
+ #
45
+ # Outputs:
46
+ #
47
+ # # First line.
48
+ # # Second line.
49
+ # gem "my_gem"
50
+ #
51
+ # [+:group+]
52
+ # The gem group in the +Gemfile+ that the gem belongs to.
53
+ #
54
+ # [+:git+]
55
+ # The URL of the git repository for the gem.
56
+ #
57
+ # Any additional options passed to this method will be appended to the
58
+ # +gem+ declaration in the +Gemfile+. For example:
59
+ #
60
+ # gem "my_gem", comment: "Edge my_gem", git: "https://example.com/my_gem.git", branch: "master"
61
+ #
62
+ # Outputs:
63
+ #
64
+ # # Edge my_gem
65
+ # gem "my_gem", git: "https://example.com/my_gem.git", branch: "master"
66
+ #
22
67
  def gem(*args)
23
68
  options = args.extract_options!
24
69
  name, *versions = args
@@ -117,18 +162,47 @@ module Rails
117
162
  end
118
163
  end
119
164
 
120
- # Adds a line inside the Application class for <tt>config/application.rb</tt>.
165
+ # Adds configuration code to a Rails runtime environment.
166
+ #
167
+ # By default, adds code inside the +Application+ class in
168
+ # +config/application.rb+ so that it applies to all environments.
169
+ #
170
+ # environment %(config.asset_host = "cdn.provider.com")
171
+ #
172
+ # Results in:
173
+ #
174
+ # # config/application.rb
175
+ # class Application < Rails::Application
176
+ # config.asset_host = "cdn.provider.com"
177
+ # # ...
178
+ # end
179
+ #
180
+ # If the +:env+ option is specified, the code will be added to the
181
+ # corresponding file in +config/environments+ instead.
182
+ #
183
+ # environment %(config.asset_host = "localhost:3000"), env: "development"
184
+ #
185
+ # Results in:
121
186
  #
122
- # If options <tt>:env</tt> is specified, the line is appended to the corresponding
123
- # file in <tt>config/environments</tt>.
187
+ # # config/environments/development.rb
188
+ # Rails.application.configure do
189
+ # config.asset_host = "localhost:3000"
190
+ # # ...
191
+ # end
192
+ #
193
+ # +:env+ can also be an array. In which case, the code is added to each
194
+ # corresponding file in +config/environments+.
195
+ #
196
+ # The code can also be specified as the return value of the block:
124
197
  #
125
198
  # environment do
126
- # "config.asset_host = 'cdn.provider.com'"
199
+ # %(config.asset_host = "cdn.provider.com")
127
200
  # end
128
201
  #
129
202
  # environment(nil, env: "development") do
130
- # "config.asset_host = 'localhost:3000'"
203
+ # %(config.asset_host = "localhost:3000")
131
204
  # end
205
+ #
132
206
  def environment(data = nil, options = {})
133
207
  sentinel = "class Application < Rails::Application\n"
134
208
  env_file_sentinel = "Rails.application.configure do\n"
@@ -146,11 +220,20 @@ module Rails
146
220
  end
147
221
  alias :application :environment
148
222
 
149
- # Run a command in git.
223
+ # Runs one or more git commands.
150
224
  #
151
225
  # git :init
226
+ # # => runs `git init`
227
+ #
152
228
  # git add: "this.file that.rb"
153
- # git add: "onefile.rb", rm: "badfile.cxx"
229
+ # # => runs `git add this.file that.rb`
230
+ #
231
+ # git commit: "-m 'First commit'"
232
+ # # => runs `git commit -m 'First commit'`
233
+ #
234
+ # git add: "good.rb", rm: "bad.cxx"
235
+ # # => runs `git add good.rb; git rm bad.cxx`
236
+ #
154
237
  def git(commands = {})
155
238
  if commands.is_a?(Symbol)
156
239
  run "git #{commands}"
@@ -161,80 +244,91 @@ module Rails
161
244
  end
162
245
  end
163
246
 
164
- # Create a new file in the <tt>vendor/</tt> directory. Code can be specified
165
- # in a block or a data string can be given.
247
+ # Creates a file in +vendor/+. The contents can be specified as an
248
+ # argument or as the return value of the block.
249
+ #
250
+ # vendor "foreign.rb", <<~RUBY
251
+ # # Foreign code is fun
252
+ # RUBY
166
253
  #
167
- # vendor("sekrit.rb") do
168
- # sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--"
169
- # "salt = '#{sekrit_salt}'"
254
+ # vendor "foreign.rb" do
255
+ # "# Foreign code is fun"
170
256
  # end
171
257
  #
172
- # vendor("foreign.rb", "# Foreign code is fun")
173
258
  def vendor(filename, data = nil)
174
259
  log :vendor, filename
175
260
  data ||= yield if block_given?
176
261
  create_file("vendor/#{filename}", optimize_indentation(data), verbose: false)
177
262
  end
178
263
 
179
- # Create a new file in the <tt>lib/</tt> directory. Code can be specified
180
- # in a block or a data string can be given.
264
+ # Creates a file in +lib/+. The contents can be specified as an argument
265
+ # or as the return value of the block.
266
+ #
267
+ # lib "foreign.rb", <<~RUBY
268
+ # # Foreign code is fun
269
+ # RUBY
181
270
  #
182
- # lib("crypto.rb") do
183
- # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'"
271
+ # lib "foreign.rb" do
272
+ # "# Foreign code is fun"
184
273
  # end
185
274
  #
186
- # lib("foreign.rb", "# Foreign code is fun")
187
275
  def lib(filename, data = nil)
188
276
  log :lib, filename
189
277
  data ||= yield if block_given?
190
278
  create_file("lib/#{filename}", optimize_indentation(data), verbose: false)
191
279
  end
192
280
 
193
- # Create a new +Rakefile+ with the provided code (either in a block or a string).
281
+ # Creates a Rake tasks file in +lib/tasks/+. The code can be specified as
282
+ # an argument or as the return value of the block.
194
283
  #
195
- # rakefile("bootstrap.rake") do
284
+ # rakefile "bootstrap.rake", <<~RUBY
285
+ # task :bootstrap do
286
+ # puts "Boots! Boots! Boots!"
287
+ # end
288
+ # RUBY
289
+ #
290
+ # rakefile "bootstrap.rake" do
196
291
  # project = ask("What is the UNIX name of your project?")
197
292
  #
198
- # <<-TASK
293
+ # <<~RUBY
199
294
  # namespace :#{project} do
200
295
  # task :bootstrap do
201
- # puts "I like boots!"
296
+ # puts "Boots! Boots! Boots!"
202
297
  # end
203
298
  # end
204
- # TASK
299
+ # RUBY
205
300
  # end
206
301
  #
207
- # rakefile('seed.rake', 'puts "Planting seeds"')
208
302
  def rakefile(filename, data = nil)
209
303
  log :rakefile, filename
210
304
  data ||= yield if block_given?
211
305
  create_file("lib/tasks/#{filename}", optimize_indentation(data), verbose: false)
212
306
  end
213
307
 
214
- # Create a new initializer with the provided code (either in a block or a string).
308
+ # Creates an initializer file in +config/initializers/+. The code can be
309
+ # specified as an argument or as the return value of the block.
215
310
  #
216
- # initializer("globals.rb") do
217
- # data = ""
311
+ # initializer "api.rb", <<~RUBY
312
+ # API_KEY = "123456"
313
+ # RUBY
218
314
  #
219
- # ['MY_WORK', 'ADMINS', 'BEST_COMPANY_EVAR'].each do |const|
220
- # data << "#{const} = :entp\n"
221
- # end
222
- #
223
- # data
315
+ # initializer "api.rb" do
316
+ # %(API_KEY = "123456")
224
317
  # end
225
318
  #
226
- # initializer("api.rb", "API_KEY = '123456'")
227
319
  def initializer(filename, data = nil)
228
320
  log :initializer, filename
229
321
  data ||= yield if block_given?
230
322
  create_file("config/initializers/#{filename}", optimize_indentation(data), verbose: false)
231
323
  end
232
324
 
233
- # Generate something using a generator from Rails or a plugin.
234
- # The second parameter is the argument string that is passed to
235
- # the generator or an Array that is joined.
325
+ # Runs another generator.
326
+ #
327
+ # generate "scaffold", "Post title:string body:text"
328
+ # generate "scaffold", "Post", "title:string", "body:text"
236
329
  #
237
- # generate(:authenticated, "user session")
330
+ # The first argument is the generator name, and the remaining arguments
331
+ # are joined together and passed to the generator.
238
332
  def generate(what, *args)
239
333
  log :generate, what
240
334
 
@@ -244,22 +338,56 @@ module Rails
244
338
  rails_command "generate #{what} #{args.join(" ")}", options
245
339
  end
246
340
 
247
- # Runs the supplied rake task (invoked with 'rake ...')
341
+ # Runs the specified Rake task.
342
+ #
343
+ # rake "db:migrate"
344
+ # rake "db:migrate", env: "production"
345
+ # rake "db:migrate", abort_on_failure: true
346
+ # rake "stats", capture: true
347
+ # rake "gems:install", sudo: true
348
+ #
349
+ # ==== Options
350
+ #
351
+ # [+:env+]
352
+ # The Rails environment in which to run the task. Defaults to
353
+ # <tt>ENV["RAILS_ENV"] || "development"</tt>.
354
+ #
355
+ # [+:abort_on_failure+]
356
+ # Whether to halt the generator if the task exits with a non-success
357
+ # exit status.
248
358
  #
249
- # rake("db:migrate")
250
- # rake("db:migrate", env: "production")
251
- # rake("gems:install", sudo: true)
252
- # rake("gems:install", capture: true)
359
+ # [+:capture+]
360
+ # Whether to capture and return the output of the task.
361
+ #
362
+ # [+:sudo+]
363
+ # Whether to run the task using +sudo+.
253
364
  def rake(command, options = {})
254
365
  execute_command :rake, command, options
255
366
  end
256
367
 
257
- # Runs the supplied rake task (invoked with 'rails ...')
368
+ # Runs the specified Rails command.
369
+ #
370
+ # rails_command "db:migrate"
371
+ # rails_command "db:migrate", env: "production"
372
+ # rails_command "db:migrate", abort_on_failure: true
373
+ # rails_command "stats", capture: true
374
+ # rails_command "gems:install", sudo: true
375
+ #
376
+ # ==== Options
377
+ #
378
+ # [+:env+]
379
+ # The Rails environment in which to run the command. Defaults to
380
+ # <tt>ENV["RAILS_ENV"] || "development"</tt>.
381
+ #
382
+ # [+:abort_on_failure+]
383
+ # Whether to halt the generator if the command exits with a non-success
384
+ # exit status.
385
+ #
386
+ # [+:capture+]
387
+ # Whether to capture and return the output of the command.
258
388
  #
259
- # rails_command("db:migrate")
260
- # rails_command("db:migrate", env: "production")
261
- # rails_command("gems:install", sudo: true)
262
- # rails_command("gems:install", capture: true)
389
+ # [+:sudo+]
390
+ # Whether to run the command using +sudo+.
263
391
  def rails_command(command, options = {})
264
392
  if options[:inline]
265
393
  log :rails, command
@@ -274,7 +274,7 @@ module Rails
274
274
  class_option :api, type: :boolean, desc: "Preconfigure smaller stack for API only apps"
275
275
  class_option :minimal, type: :boolean, desc: "Preconfigure a minimal rails app"
276
276
  class_option :javascript, type: :string, aliases: "-j", default: "importmap", desc: "Choose JavaScript approach [options: importmap (default), webpack, esbuild, rollup]"
277
- class_option :css, type: :string, aliases: "-c", desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass... check https://github.com/rails/cssbundling-rails]"
277
+ class_option :css, type: :string, aliases: "-c", desc: "Choose CSS processor [options: tailwind, bootstrap, bulma, postcss, sass] check https://github.com/rails/cssbundling-rails"
278
278
  class_option :skip_bundle, type: :boolean, aliases: "-B", default: false, desc: "Don't run bundle install"
279
279
 
280
280
  def initialize(*args)
@@ -438,7 +438,7 @@ module Rails
438
438
 
439
439
  def delete_app_views_if_api_option
440
440
  if options[:api]
441
- if options[:skip_action_mailer]
441
+ if skip_action_mailer?
442
442
  remove_dir "app/views"
443
443
  else
444
444
  remove_file "app/views/layouts/application.html.erb"
@@ -483,7 +483,7 @@ module Rails
483
483
  end
484
484
 
485
485
  def delete_action_mailer_files_skipping_action_mailer
486
- if options[:skip_action_mailer]
486
+ if skip_action_mailer?
487
487
  remove_file "app/views/layouts/mailer.html.erb"
488
488
  remove_file "app/views/layouts/mailer.text.erb"
489
489
  remove_dir "app/mailers"
@@ -39,7 +39,7 @@ Rails.application.configure do
39
39
  # Store uploaded files on the local file system (see config/storage.yml for options).
40
40
  config.active_storage.service = :local
41
41
  <%- end -%>
42
- <%- unless options.skip_action_mailer? -%>
42
+ <%- unless skip_action_mailer? -%>
43
43
 
44
44
  # Don't care if the mailer can't send.
45
45
  config.action_mailer.raise_delivery_errors = false
@@ -72,7 +72,7 @@ Rails.application.configure do
72
72
  # config.active_job.queue_name_prefix = "<%= app_name %>_production"
73
73
 
74
74
  <%- end -%>
75
- <%- unless options.skip_action_mailer? -%>
75
+ <%- unless skip_action_mailer? -%>
76
76
  config.action_mailer.perform_caching = false
77
77
 
78
78
  # Ignore bad email addresses and do not raise email delivery errors.
@@ -38,7 +38,7 @@ Rails.application.configure do
38
38
  config.active_storage.service = :test
39
39
 
40
40
  <%- end -%>
41
- <%- unless options.skip_action_mailer? -%>
41
+ <%- unless skip_action_mailer? -%>
42
42
  config.action_mailer.perform_caching = false
43
43
 
44
44
  # Tell Action Mailer not to deliver emails to the real world.
@@ -109,7 +109,7 @@
109
109
 
110
110
 
111
111
  # Cookie serializer: 2 options
112
- #
112
+ #
113
113
  # If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
114
114
  # is `:marshal`. The default for new apps is `:json`.
115
115
  #
@@ -117,10 +117,10 @@
117
117
  #
118
118
  #
119
119
  # To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
120
- #
120
+ #
121
121
  # Rails transparently deserializes existing (Marshal-serialized) cookies on read and
122
122
  # re-writes them in the JSON format.
123
- #
123
+ #
124
124
  # It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
125
125
  # have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
126
126
  # initializer or to `config/application.rb`.
@@ -131,5 +131,18 @@
131
131
  # If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
132
132
  #
133
133
  # If you have configured the serializer elsewhere, you can remove this section of the file.
134
- #
134
+ #
135
135
  # See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
136
+
137
+ # Change the return value of `ActionDispatch::Request#content_type` to the Content-Type header without modification.
138
+ # Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type = false
139
+
140
+ # Active Storage `has_many_attached` relationships will default to replacing the current collection instead of appending to it.
141
+ # Thus, to support submitting an empty collection, the `file_field` helper will render an hidden field `include_hidden` by default when `multiple_file_field_include_hidden` is set to `true`.
142
+ # See https://guides.rubyonrails.org/configuring.html#config-active-storage-multiple-file-field-include-hidden for more information.
143
+ # Rails.application.config.active_storage.multiple_file_field_include_hidden = true
144
+
145
+ # ** Please read carefully, this must be configured in config/application.rb (NOT this file) **
146
+ # Disables the deprecated #to_s override in some Ruby core classes
147
+ # See https://guides.rubyonrails.org/configuring.html#config-active-support-disable-to-s-conversion for more information.
148
+ # config.active_support.disable_to_s_conversion = true
@@ -28,14 +28,14 @@ module Rails
28
28
 
29
29
  empty_directory_with_keep_file "app/models/concerns"
30
30
  empty_directory_with_keep_file "app/controllers/concerns"
31
- remove_dir "app/mailers" if options[:skip_action_mailer]
31
+ remove_dir "app/mailers" if skip_action_mailer?
32
32
  remove_dir "app/jobs" if options[:skip_active_job]
33
33
  elsif full?
34
34
  empty_directory_with_keep_file "app/models"
35
35
  empty_directory_with_keep_file "app/controllers"
36
36
  empty_directory_with_keep_file "app/models/concerns"
37
37
  empty_directory_with_keep_file "app/controllers/concerns"
38
- empty_directory_with_keep_file "app/mailers" unless options[:skip_action_mailer]
38
+ empty_directory_with_keep_file "app/mailers" unless skip_action_mailer?
39
39
  empty_directory_with_keep_file "app/jobs" unless options[:skip_active_job]
40
40
 
41
41
  unless api?
@@ -317,6 +317,7 @@ module Rails
317
317
  [
318
318
  rails_gemfile_entry,
319
319
  simplify_gemfile_entries(
320
+ web_server_gemfile_entry,
320
321
  database_gemfile_entry,
321
322
  asset_pipeline_gemfile_entry,
322
323
  ),
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.homepage = "TODO"
9
9
  spec.summary = "TODO: Summary of <%= camelized_modules %>."
10
10
  spec.description = "TODO: Description of <%= camelized_modules %>."
11
- <% unless inside_application? -%>
11
+ <%- unless inside_application? -%>
12
12
  spec.license = "MIT"
13
- <% end -%>
13
+ <%- end -%>
14
14
 
15
15
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
16
16
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -17,11 +17,13 @@ require "rails/all"
17
17
  require "rails"
18
18
  # Pick the frameworks you want:
19
19
  require "active_model/railtie"
20
- require "active_job/railtie"
20
+ <%= comment_if :skip_active_job %>require "active_job/railtie"
21
21
  <%= comment_if :skip_active_record %>require "active_record/railtie"
22
22
  <%= comment_if :skip_active_storage %>require "active_storage/engine"
23
23
  require "action_controller/railtie"
24
24
  <%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
25
+ <%= comment_if :skip_action_mailbox %>require "action_mailbox/engine"
26
+ <%= comment_if :skip_action_text %>require "action_text/engine"
25
27
  require "action_view/railtie"
26
28
  <%= comment_if :skip_action_cable %>require "action_cable/engine"
27
29
  <%= comment_if :skip_test %>require "rails/test_unit/railtie"
@@ -43,7 +43,7 @@ class <%= controller_class_name %>Controller < ApplicationController
43
43
  # DELETE <%= route_url %>/1
44
44
  def destroy
45
45
  @<%= orm_instance.destroy %>
46
- redirect_to <%= index_helper %>_url, notice: <%= %("#{human_name} was successfully destroyed.") %>
46
+ redirect_to <%= index_helper %>_url, notice: <%= %("#{human_name} was successfully destroyed.") %>, status: :see_other
47
47
  end
48
48
 
49
49
  private
@@ -67,7 +67,7 @@ module Rails
67
67
  def run_generator(args = default_arguments, config = {})
68
68
  capture(:stdout) do
69
69
  args += ["--skip-bundle"] unless args.include?("--no-skip-bundle") || args.include?("--dev")
70
- args |= ["--skip-bootsnap"] unless args.include?("--no-skip-bootsnap")
70
+ args += ["--skip-bootsnap"] unless args.include?("--no-skip-bootsnap") || args.include?("--skip-bootsnap")
71
71
 
72
72
  generator_class.start(args, config.reverse_merge(destination_root: destination_root))
73
73
  end
@@ -31,6 +31,10 @@ if defined?(ActiveRecord::Base)
31
31
  ActiveSupport.on_load(:action_dispatch_integration_test) do
32
32
  self.fixture_path = ActiveSupport::TestCase.fixture_path
33
33
  end
34
+ else
35
+ ActiveSupport.on_load(:active_support_test_case) do
36
+ self.file_fixture_path = "#{Rails.root}/test/fixtures/files"
37
+ end
34
38
  end
35
39
 
36
40
  # :enddoc:
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.4.3
4
+ version: 7.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-13 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.4.3
19
+ version: 7.0.6
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.4.3
26
+ version: 7.0.6
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.4.3
33
+ version: 7.0.6
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.4.3
40
+ version: 7.0.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 7.0.4.3
103
+ version: 7.0.6
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.4.3
110
+ version: 7.0.6
111
111
  description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
112
112
  email: david@loudthinking.com
113
113
  executables:
@@ -422,12 +422,12 @@ licenses:
422
422
  - MIT
423
423
  metadata:
424
424
  bug_tracker_uri: https://github.com/rails/rails/issues
425
- changelog_uri: https://github.com/rails/rails/blob/v7.0.4.3/railties/CHANGELOG.md
426
- documentation_uri: https://api.rubyonrails.org/v7.0.4.3/
425
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.6/railties/CHANGELOG.md
426
+ documentation_uri: https://api.rubyonrails.org/v7.0.6/
427
427
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
428
- source_code_uri: https://github.com/rails/rails/tree/v7.0.4.3/railties
428
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.6/railties
429
429
  rubygems_mfa_required: 'true'
430
- post_install_message:
430
+ post_install_message:
431
431
  rdoc_options:
432
432
  - "--exclude"
433
433
  - "."
@@ -444,8 +444,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
444
444
  - !ruby/object:Gem::Version
445
445
  version: '0'
446
446
  requirements: []
447
- rubygems_version: 3.4.3
448
- signing_key:
447
+ rubygems_version: 3.4.13
448
+ signing_key:
449
449
  specification_version: 4
450
450
  summary: Tools for creating, working with, and running Rails applications.
451
451
  test_files: []