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
@@ -1,7 +1,7 @@
1
1
  require "fileutils"
2
2
 
3
3
  # path to your application root.
4
- APP_ROOT = File.expand_path('..', __dir__)
4
+ APP_ROOT = File.expand_path("..", __dir__)
5
5
 
6
6
  def system!(*args)
7
7
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -12,28 +12,23 @@ FileUtils.chdir APP_ROOT do
12
12
  # This script is idempotent, so that you can run it at any time and get an expectable outcome.
13
13
  # Add necessary setup steps to this file.
14
14
 
15
- puts '== Installing dependencies =='
16
- system! 'gem install bundler --conservative'
17
- system('bundle check') || system!('bundle install')
18
- <% unless options.skip_javascript? -%>
19
-
20
- # Install JavaScript dependencies
21
- system! 'bin/yarn'
22
- <% end -%>
15
+ puts "== Installing dependencies =="
16
+ system! "gem install bundler --conservative"
17
+ system("bundle check") || system!("bundle install")
23
18
  <% unless options.skip_active_record? -%>
24
19
 
25
20
  # puts "\n== Copying sample files =="
26
- # unless File.exist?('config/database.yml')
27
- # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
28
23
  # end
29
24
 
30
25
  puts "\n== Preparing database =="
31
- system! 'bin/rails db:prepare'
26
+ system! "bin/rails db:prepare"
32
27
  <% end -%>
33
28
 
34
29
  puts "\n== Removing old logs and tempfiles =="
35
- system! 'bin/rails log:clear tmp:clear'
30
+ system! "bin/rails log:clear tmp:clear"
36
31
 
37
32
  puts "\n== Restarting application server =="
38
- system! 'bin/rails restart'
33
+ system! "bin/rails restart"
39
34
  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
 
@@ -1,4 +1,4 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
1
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2
2
 
3
3
  require "bundler/setup" # Set up gems listed in the Gemfile.
4
4
  <% if depend_on_bootsnap? -%>
@@ -3,7 +3,7 @@
3
3
  # gem install activerecord-jdbcmssql-adapter
4
4
  #
5
5
  # Configure using Gemfile:
6
- # gem 'activerecord-jdbcmssql-adapter'
6
+ # gem "activerecord-jdbcmssql-adapter"
7
7
  #
8
8
  # development:
9
9
  # adapter: mssql
@@ -65,4 +65,4 @@ test:
65
65
  production:
66
66
  url: jdbc:db://localhost/<%= app_name %>_production
67
67
  username: <%= app_name %>
68
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
68
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -4,7 +4,7 @@
4
4
  # gem install activerecord-jdbcmysql-adapter
5
5
  #
6
6
  # Configure Using Gemfile
7
- # gem 'activerecord-jdbcmysql-adapter'
7
+ # gem "activerecord-jdbcmysql-adapter"
8
8
  #
9
9
  # And be sure to use new-style password hashing:
10
10
  # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
@@ -42,7 +42,7 @@ test:
42
42
  # URL environment variable explicitly:
43
43
  #
44
44
  # production:
45
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
45
+ # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
46
46
  #
47
47
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
48
48
  # for a full overview on how database connection configuration can be specified.
@@ -51,4 +51,4 @@ production:
51
51
  <<: *default
52
52
  database: <%= app_name %>_production
53
53
  username: <%= app_name %>
54
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
54
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -1,7 +1,7 @@
1
1
  # PostgreSQL. Versions 9.3 and up are supported.
2
2
  #
3
3
  # Configure Using Gemfile
4
- # gem 'activerecord-jdbcpostgresql-adapter'
4
+ # gem "activerecord-jdbcpostgresql-adapter"
5
5
  #
6
6
  default: &default
7
7
  adapter: postgresql
@@ -58,7 +58,7 @@ test:
58
58
  # URL environment variable explicitly:
59
59
  #
60
60
  # production:
61
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
61
+ # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
62
62
  #
63
63
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
64
64
  # for a full overview on how database connection configuration can be specified.
@@ -67,4 +67,4 @@ production:
67
67
  <<: *default
68
68
  database: <%= app_name %>_production
69
69
  username: <%= app_name %>
70
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
70
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -1,8 +1,8 @@
1
1
  # SQLite. Versions 3.8.0 and up are supported.
2
- # gem 'activerecord-jdbcsqlite3-adapter'
2
+ # gem "activerecord-jdbcsqlite3-adapter"
3
3
  #
4
4
  # Configure Using Gemfile
5
- # gem 'activerecord-jdbcsqlite3-adapter'
5
+ # gem "activerecord-jdbcsqlite3-adapter"
6
6
  #
7
7
  default: &default
8
8
  adapter: sqlite3
@@ -4,7 +4,7 @@
4
4
  # gem install mysql2
5
5
  #
6
6
  # Ensure the MySQL gem is defined in your Gemfile
7
- # gem 'mysql2'
7
+ # gem "mysql2"
8
8
  #
9
9
  # And be sure to use new-style password hashing:
10
10
  # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
@@ -47,7 +47,7 @@ test:
47
47
  # URL environment variable explicitly:
48
48
  #
49
49
  # production:
50
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
50
+ # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
51
51
  #
52
52
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
53
53
  # for a full overview on how database connection configuration can be specified.
@@ -56,4 +56,4 @@ production:
56
56
  <<: *default
57
57
  database: <%= app_name %>_production
58
58
  username: <%= app_name %>
59
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
59
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -50,7 +50,7 @@ test:
50
50
  # URL environment variable explicitly:
51
51
  #
52
52
  # production:
53
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
53
+ # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
54
54
  #
55
55
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
56
56
  # for a full overview on how database connection configuration can be specified.
@@ -59,4 +59,4 @@ production:
59
59
  <<: *default
60
60
  database: <%= app_name %>_production
61
61
  username: <%= app_name %>
62
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
62
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -12,7 +12,7 @@
12
12
  # Install PostgreSQL and put its /bin directory on your path.
13
13
  #
14
14
  # Configure Using Gemfile
15
- # gem 'pg'
15
+ # gem "pg"
16
16
  #
17
17
  default: &default
18
18
  adapter: postgresql
@@ -74,7 +74,7 @@ test:
74
74
  # URL environment variable explicitly:
75
75
  #
76
76
  # production:
77
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
77
+ # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
78
78
  #
79
79
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
80
80
  # for a full overview on how database connection configuration can be specified.
@@ -83,4 +83,4 @@ production:
83
83
  <<: *default
84
84
  database: <%= app_name %>_production
85
85
  username: <%= app_name %>
86
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
86
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -2,7 +2,7 @@
2
2
  # gem install sqlite3
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
5
+ # gem "sqlite3"
6
6
  #
7
7
  default: &default
8
8
  adapter: sqlite3
@@ -5,14 +5,14 @@
5
5
  # gem install activerecord-sqlserver-adapter
6
6
  #
7
7
  # Ensure the activerecord adapter and db driver gems are defined in your Gemfile
8
- # gem 'tiny_tds'
9
- # gem 'activerecord-sqlserver-adapter'
8
+ # gem "tiny_tds"
9
+ # gem "activerecord-sqlserver-adapter"
10
10
  #
11
11
  default: &default
12
12
  adapter: sqlserver
13
13
  encoding: utf8
14
14
  username: sa
15
- password: <%%= ENV['SA_PASSWORD'] %>
15
+ password: <%%= ENV["SA_PASSWORD"] %>
16
16
  host: localhost
17
17
 
18
18
  development:
@@ -41,7 +41,7 @@ test:
41
41
  # URL environment variable explicitly:
42
42
  #
43
43
  # production:
44
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
44
+ # url: <%%= ENV["MY_APP_DATABASE_URL"] %>
45
45
  #
46
46
  # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
47
47
  # for a full overview on how database connection configuration can be specified.
@@ -50,4 +50,4 @@ production:
50
50
  <<: *default
51
51
  database: <%= app_name %>_production
52
52
  username: <%= app_name %>
53
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
53
+ password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
@@ -14,9 +14,12 @@ 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
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
22
+ if Rails.root.join("tmp/caching-dev.txt").exist?
20
23
  <%- unless options.api? -%>
21
24
  config.action_controller.perform_caching = true
22
25
  config.action_controller.enable_fragment_cache_logging = true
@@ -24,7 +27,7 @@ Rails.application.configure do
24
27
  <%- end -%>
25
28
  config.cache_store = :memory_store
26
29
  config.public_file_server.headers = {
27
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
30
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
28
31
  }
29
32
  else
30
33
  config.action_controller.perform_caching = false
@@ -61,12 +64,7 @@ Rails.application.configure do
61
64
  config.active_record.verbose_query_logs = true
62
65
 
63
66
  <%- end -%>
64
- <%- unless options.skip_sprockets? -%>
65
- # Debug mode disables concatenation and preprocessing of assets.
66
- # This option may cause significant delays in view rendering with a large
67
- # number of complex assets.
68
- config.assets.debug = true
69
-
67
+ <%- unless skip_sprockets? -%>
70
68
  # Suppress logger output for asset requests.
71
69
  config.assets.quiet = true
72
70
  <%- end -%>
@@ -77,10 +75,6 @@ Rails.application.configure do
77
75
  # Annotate rendered view with file names.
78
76
  # config.action_view.annotate_rendered_view_with_filenames = true
79
77
 
80
- # Use an evented file watcher to asynchronously detect changes in source code,
81
- # routes, locales, etc. This feature depends on the listen gem.
82
- <%= '# ' unless depend_on_listen? %>config.file_watcher = ActiveSupport::EventedFileUpdateChecker
83
-
84
78
  # Uncomment if you wish to allow Action Cable access from any origin.
85
79
  # config.action_cable.disable_request_forgery_protection = true
86
80
  end
@@ -24,9 +24,9 @@ Rails.application.configure do
24
24
 
25
25
  # Disable serving static files from the `/public` folder by default since
26
26
  # Apache or NGINX already handles this.
27
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
27
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
28
28
 
29
- <%- unless options.skip_sprockets? -%>
29
+ <%- unless skip_sprockets? -%>
30
30
  # Compress CSS using a preprocessor.
31
31
  # config.assets.css_compressor = :sass
32
32
 
@@ -35,11 +35,11 @@ Rails.application.configure do
35
35
 
36
36
  <%- end -%>
37
37
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
38
- # config.asset_host = 'http://assets.example.com'
38
+ # config.asset_host = "http://assets.example.com"
39
39
 
40
40
  # Specifies the header that your server uses for sending files.
41
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
41
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
42
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
43
43
 
44
44
  <%- unless skip_active_storage? -%>
45
45
  # Store uploaded files on the local file system (see config/storage.yml for options).
@@ -49,8 +49,8 @@ Rails.application.configure do
49
49
  <%- unless options[:skip_action_cable] -%>
50
50
  # Mount Action Cable outside main process or domain.
51
51
  # config.action_cable.mount_path = nil
52
- # config.action_cable.url = 'wss://example.com/cable'
53
- # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
52
+ # config.action_cable.url = "wss://example.com/cable"
53
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
54
54
 
55
55
  <%- end -%>
56
56
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
@@ -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
 
@@ -84,21 +84,15 @@ Rails.application.configure do
84
84
  # the I18n.default_locale when a translation cannot be found).
85
85
  config.i18n.fallbacks = true
86
86
 
87
- # Send deprecation notices to registered listeners.
88
- config.active_support.deprecation = :notify
89
-
90
- # Log disallowed deprecations.
91
- config.active_support.disallowed_deprecation = :log
92
-
93
- # Tell Active Support which deprecation messages to disallow.
94
- config.active_support.disallowed_deprecation_warnings = []
87
+ # Don't log any deprecations.
88
+ config.active_support.report_deprecations = false
95
89
 
96
90
  # Use default logging formatter so that PID and timestamp are not suppressed.
97
91
  config.log_formatter = ::Logger::Formatter.new
98
92
 
99
93
  # Use a different logger for distributed setups.
100
94
  # require "syslog/logger"
101
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
95
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
102
96
 
103
97
  if ENV["RAILS_LOG_TO_STDOUT"].present?
104
98
  logger = ActiveSupport::Logger.new(STDOUT)
@@ -110,25 +104,4 @@ Rails.application.configure do
110
104
  # Do not dump schema after migrations.
111
105
  config.active_record.dump_schema_after_migration = false
112
106
  <%- end -%>
113
-
114
- # Inserts middleware to perform automatic connection switching.
115
- # The `database_selector` hash is used to pass options to the DatabaseSelector
116
- # middleware. The `delay` is used to determine how long to wait after a write
117
- # to send a subsequent read to the primary.
118
- #
119
- # The `database_resolver` class is used by the middleware to determine which
120
- # database is appropriate to use based on the time delay.
121
- #
122
- # The `database_resolver_context` class is used by the middleware to set
123
- # timestamps for the last write to the primary. The resolver uses the context
124
- # class timestamps to determine how long to wait before reading from the
125
- # replica.
126
- #
127
- # By default Rails will store a last write timestamp in the session. The
128
- # DatabaseSelector middleware is designed as such you can define your own
129
- # strategy for connection switching and pass that into the middleware through
130
- # these configuration options.
131
- # config.active_record.database_selector = { delay: 2.seconds }
132
- # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
133
- # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
134
107
  end
@@ -8,23 +8,18 @@ require "active_support/core_ext/integer/time"
8
8
  Rails.application.configure do
9
9
  # Settings specified here will take precedence over those in config/application.rb.
10
10
 
11
- <%-# Spring executes the reloaders when files change. -%>
12
- <%- if spring_install? -%>
13
- config.cache_classes = false
14
- config.action_view.cache_template_loading = true
15
- <%- else -%>
11
+ # Turn false under Spring and add config.action_view.cache_template_loading = true
16
12
  config.cache_classes = true
17
- <%- end -%>
18
13
 
19
- # Do not eager load code on boot. This avoids loading your whole application
20
- # just for the purpose of running a single test. If you are using a tool that
21
- # preloads Rails for running tests, you may have to set it to true.
22
- config.eager_load = false
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?
23
18
 
24
19
  # Configure public file server for tests with Cache-Control for performance.
25
20
  config.public_file_server.enabled = true
26
21
  config.public_file_server.headers = {
27
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
22
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
28
23
  }
29
24
 
30
25
  # Show full error reports and disable caching.
@@ -1,14 +1,10 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
3
  # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
4
+ Rails.application.config.assets.version = "1.0"
5
5
 
6
6
  # Add additional assets to the asset load path.
7
7
  # Rails.application.config.assets.paths << Emoji.images_path
8
- <%- unless options[:skip_javascript] -%>
9
- # Add Yarn node_modules folder to the asset load path.
10
- Rails.application.config.assets.paths << Rails.root.join('node_modules')
11
- <%- end -%>
12
8
 
13
9
  # Precompile additional assets.
14
10
  # application.js, application.css, and all non-JS/CSS in the app/assets
@@ -4,29 +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.config.content_security_policy do |policy|
8
- # policy.default_src :self, :https
9
- # policy.font_src :self, :https, :data
10
- # policy.img_src :self, :https, :data
11
- # policy.object_src :none
12
- # policy.script_src :self, :https
13
- # policy.style_src :self, :https
14
- <%- unless options[:skip_javascript] -%>
15
- # # If you are using webpack-dev-server then specify webpack-dev-server host
16
- # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
17
- <%- end -%>
18
-
19
- # # Specify URI for violation reports
20
- # # policy.report_uri "/csp-violation-report-endpoint"
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
21
26
  # end
22
-
23
- # If you are using UJS then enable automatic nonce generation
24
- # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
25
-
26
- # Set the nonce only to specific directives
27
- # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
28
-
29
- # Report CSP violations to a specified URI
30
- # For further information see the following documentation:
31
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
32
- # Rails.application.config.content_security_policy_report_only = true
@@ -7,9 +7,9 @@
7
7
 
8
8
  # Rails.application.config.middleware.insert_before 0, Rack::Cors do
9
9
  # allow do
10
- # origins 'example.com'
10
+ # origins "example.com"
11
11
  #
12
- # resource '*',
12
+ # resource "*",
13
13
  # headers: :any,
14
14
  # methods: [:get, :post, :put, :patch, :delete, :options, :head]
15
15
  # end
@@ -4,13 +4,13 @@
4
4
  # are locale specific, and you may define rules for as many different
5
5
  # locales as you wish. All of these examples are active by default:
6
6
  # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
7
+ # inflect.plural /^(ox)$/i, "\\1en"
8
+ # inflect.singular /^(ox)en/i, "\\1"
9
+ # inflect.irregular "person", "people"
10
10
  # inflect.uncountable %w( fish sheep )
11
11
  # end
12
12
 
13
13
  # These inflection rules are supported but not enabled by default:
14
14
  # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
15
+ # inflect.acronym "RESTful"
16
16
  # end
@@ -0,0 +1,117 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file eases your Rails 7.0 framework defaults upgrade.
4
+ #
5
+ # Uncomment each configuration one by one to switch to the new default.
6
+ # Once your application is ready to run with all new defaults, you can remove
7
+ # this file and set the `config.load_defaults` to `7.0`.
8
+ #
9
+ # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10
+ # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
+
12
+ # `button_to` view helper will render `<button>` element, regardless of whether
13
+ # or not the content is passed as the first argument or as a block.
14
+ # Rails.application.config.action_view.button_to_generates_button_tag = true
15
+
16
+ # `stylesheet_link_tag` view helper will not render the media attribute by default.
17
+ # Rails.application.config.action_view.apply_stylesheet_media_default = false
18
+
19
+ # Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
20
+ # Changing this default means invalidate all encrypted messages generated by
21
+ # your application and, all the encrypted cookies. Only change this after you
22
+ # rotated all the messages using the key rotator.
23
+ #
24
+ # See upgrading guide for more information on how to build a rotator.
25
+ # https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
26
+ # Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
27
+
28
+ # Change the digest class for ActiveSupport::Digest.
29
+ # Changing this default means that for example Etags change and
30
+ # various cache keys leading to cache invalidation.
31
+ # Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
32
+
33
+ # Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
34
+ # implementation.
35
+ # Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
36
+
37
+ # Change the format of the cache entry.
38
+ # Changing this default means that all new cache entries added to the cache
39
+ # will have a different format that is not supported by Rails 6.1 applications.
40
+ # Only change this value after your application is fully deployed to Rails 7.0
41
+ # and you have no plans to rollback.
42
+ # Rails.application.config.active_support.cache_format_version = 7.0
43
+
44
+ # Calls `Rails.application.executor.wrap` around test cases.
45
+ # This makes test cases behave closer to an actual request or job.
46
+ # Several features that are normally disabled in test, such as Active Record query cache
47
+ # and asynchronous queries will then be enabled.
48
+ # Rails.application.config.active_support.executor_around_test_case = true
49
+
50
+ # Define the isolation level of most of Rails internal state.
51
+ # If you use a fiber based server or job processor, you should set it to `:fiber`.
52
+ # Otherwise the default of `:thread` if preferable.
53
+ # Rails.application.config.active_support.isolation_level = :thread
54
+
55
+ # Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
56
+ # Rails.application.config.action_mailer.smtp_timeout = 5
57
+
58
+ # The ActiveStorage video previewer will now use scene change detection to generate
59
+ # better preview images (rather than the previous default of using the first frame
60
+ # of the video).
61
+ # Rails.application.config.active_storage.video_preview_arguments =
62
+ # "-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"
63
+
64
+ # Automatically infer `inverse_of` for associations with a scope.
65
+ # Rails.application.config.active_record.automatic_scope_inversing = true
66
+
67
+ # Raise when running tests if fixtures contained foreign key violations
68
+ # Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
69
+
70
+ # Disable partial inserts.
71
+ # This default means that all columns will be referenced in INSERT queries
72
+ # regardless of whether they have a default or not.
73
+ # Rails.application.config.active_record.partial_inserts = false
74
+ #
75
+ # Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
76
+ # Rails.application.config.action_controller.raise_on_open_redirects = true
77
+
78
+ # Change the variant processor for Active Storage.
79
+ # Changing this default means updating all places in your code that
80
+ # generate variants to use image processing macros and ruby-vips
81
+ # operations. See the upgrading guide for detail on the changes required.
82
+ # The `:mini_magick` option is not deprecated; it's fine to keep using it.
83
+ # Rails.application.config.active_storage.variant_processor = :vips
84
+
85
+ # If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
86
+ # was `:marshal`. Convert all cookies to JSON, using the `:hybrid` formatter.
87
+ #
88
+ # If you're confident all your cookies are JSON formatted, you can switch to the `:json` formatter.
89
+ #
90
+ # Continue to use `:marshal` for backward-compatibility with old cookies.
91
+ #
92
+ # If you have configured the serializer elsewhere, you can remove this.
93
+ #
94
+ # See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
95
+ # Rails.application.config.action_dispatch.cookies_serializer = :hybrid
96
+
97
+ # Enable parameter wrapping for JSON.
98
+ # Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
99
+ # To disable parameter wrapping entirely, set this config to `false`.
100
+ # Rails.application.config.action_controller.wrap_parameters_by_default = true
101
+
102
+ # Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
103
+ # `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
104
+ #
105
+ # See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
106
+ # more information.
107
+ # Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
108
+
109
+ # Change the default headers to disable browsers' flawed legacy XSS protection.
110
+ # Rails.application.config.action_dispatch.default_headers = {
111
+ # "X-Frame-Options" => "SAMEORIGIN",
112
+ # "X-XSS-Protection" => "0",
113
+ # "X-Content-Type-Options" => "nosniff",
114
+ # "X-Download-Options" => "noopen",
115
+ # "X-Permitted-Cross-Domain-Policies" => "none",
116
+ # "Referrer-Policy" => "strict-origin-when-cross-origin"
117
+ # }