Skip to content

Commit 823de01

Browse files
committed
Revert "Resolve Rails 8 upgrade issues (#614)"
This reverts commit 005eab7.
1 parent 586dac3 commit 823de01

13 files changed

+321
-107
lines changed

.rubocop.yml

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Metrics/ClassLength:
6868
Metrics/BlockLength:
6969
Exclude:
7070
- 'config/environments/development.rb'
71-
- 'config/environments/production.rb'
7271
- 'lib/tasks/linters.rake'
7372
- 'spec/rails_helper.rb'
7473
- 'spec/system/add_new_comment_spec.rb'

bin/dev

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,2 @@
11
#!/usr/bin/env ruby
2-
# frozen_string_literal: true
3-
4-
def installed?(process)
5-
IO.popen "#{process} -v"
6-
rescue Errno::ENOENT
7-
false
8-
end
9-
10-
def run(process)
11-
system "#{process} start -f Procfile.dev"
12-
rescue Errno::ENOENT
13-
warn <<~MSG
14-
ERROR:
15-
Please ensure `Procfile.dev` exists in your project!
16-
MSG
17-
exit!
18-
end
19-
20-
if installed? "overmind"
21-
run "overmind"
22-
elsif installed? "foreman"
23-
run "foreman"
24-
else
25-
warn <<~MSG
26-
NOTICE:
27-
For this script to run, you need either 'overmind' or 'foreman' installed on your machine. Please try this script after installing one of them.
28-
MSG
29-
exit!
30-
end
2+
exec "./bin/rails", "server", *ARGV

bin/setup

-4
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ FileUtils.chdir APP_ROOT do
1313
# Add necessary setup steps to this file.
1414

1515
puts "== Installing dependencies =="
16-
system! "gem install bundler --conservative"
1716
system("bundle check") || system!("bundle install")
1817

19-
# Install JavaScript dependencies
20-
system! "bin/yarn"
21-
2218
# puts "\n== Copying sample files =="
2319
# unless File.exist?("config/database.yml")
2420
# FileUtils.cp "config/database.yml.sample", "config/database.yml"

config/application.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Application < Rails::Application
2323
# These settings can be overridden in specific environments using the files
2424
# in config/environments, which are processed later.
2525

26-
config.active_support.to_time_preserves_timezone = false
26+
config.active_support.to_time_preserves_timezone = :zone
2727
# config.time_zone = "Central Time (US & Canada)"
2828
# config.eager_load_paths << Rails.root.join("extras")
2929
end

config/database.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ default: &default
3131

3232
development:
3333
<<: *default
34-
database: react-webpack-rails-tutoria-developmentl
3534

3635
# Warning: The database defined as "test" will be erased and
3736
# re-generated from your development database when you run "rake".
3837
# Do not set this db to the same as development or production.
3938
test:
4039
<<: *default
41-
database: react-webpack-rails-tutorial-test
40+
database: react-webpack-rails-tutorial
4241

4342
production:
4443
<<: *default

config/environments/development.rb

+6-12
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
if Rails.root.join("tmp/caching-dev.txt").exist?
2323
config.action_controller.perform_caching = true
2424
config.action_controller.enable_fragment_cache_logging = true
25-
config.cache_store = :memory_store
2625
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
2726
else
28-
config.cache_store = :null_store
2927
config.action_controller.perform_caching = false
3028
end
3129

30+
# Change to :null_store to avoid any caching.
31+
config.cache_store = :memory_store
32+
3233
# Store uploaded files on the local file system (see config/storage.yml for options).
3334
config.active_storage.service = :local
3435

@@ -38,15 +39,12 @@
3839
# Make template changes take effect immediately.
3940
config.action_mailer.perform_caching = false
4041

42+
# Set localhost to be used by links generated in mailer templates.
43+
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
44+
4145
# Print deprecation notices to the Rails logger.
4246
config.active_support.deprecation = :log
4347

44-
# Raise exceptions for disallowed deprecations.
45-
config.active_support.disallowed_deprecation = :raise
46-
47-
# Tell Active Support which deprecation messages to disallow.
48-
config.active_support.disallowed_deprecation_warnings = []
49-
5048
# Raise an error on page load if there are pending migrations.
5149
config.active_record.migration_error = :page_load
5250

@@ -65,10 +63,6 @@
6563
# Annotate rendered view with file names.
6664
config.action_view.annotate_rendered_view_with_filenames = true
6765

68-
# Use an evented file watcher to asynchronously detect changes in source code,
69-
# routes, locales, etc. This feature depends on the listen gem.
70-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
71-
7266
# Uncomment if you wish to allow Action Cable access from any origin.
7367
# config.action_cable.disable_request_forgery_protection = true
7468

config/environments/production.rb

+5-46
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@
1717
# Turn on fragment caching in view templates.
1818
config.action_controller.perform_caching = true
1919

20-
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
21-
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
22-
# config.require_master_key = true
23-
24-
# Disable serving static files from the `/public` folder by default since
25-
# Apache or NGINX already handles this.
26-
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
27-
2820
# Cache assets for far-future expiry since they are all digest stamped.
2921
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
3022

@@ -53,6 +45,9 @@
5345
# Prevent health checks from clogging up the logs.
5446
config.silence_healthcheck_path = "/up"
5547

48+
# Don't log any deprecations.
49+
config.active_support.report_deprecations = false
50+
5651
# Replace the default in-process memory cache store with a durable alternative.
5752
# config.cache_store = :mem_cache_store
5853

@@ -64,7 +59,7 @@
6459
# config.action_mailer.raise_delivery_errors = false
6560

6661
# Set host to be used by links generated in mailer templates.
67-
# config.action_mailer.default_url_options = { host: "example.com" }
62+
config.action_mailer.default_url_options = { host: "example.com" }
6863

6964
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
7065
# config.action_mailer.smtp_settings = {
@@ -79,36 +74,11 @@
7974
# the I18n.default_locale when a translation cannot be found).
8075
config.i18n.fallbacks = true
8176

82-
# Don't log any deprecations.
83-
# config.active_support.report_deprecations = false
84-
85-
# Send deprecation notices to registered listeners.
86-
config.active_support.deprecation = :notify
87-
88-
# Log disallowed deprecations.
89-
config.active_support.disallowed_deprecation = :log
90-
91-
# Tell Active Support which deprecation messages to disallow.
92-
config.active_support.disallowed_deprecation_warnings = []
93-
94-
# Use default logging formatter so that PID and timestamp are not suppressed.
95-
config.log_formatter = Logger::Formatter.new
96-
97-
# Use a different logger for distributed setups.
98-
# require "syslog/logger"
99-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
100-
101-
if ENV["RAILS_LOG_TO_STDOUT"].present?
102-
logger = ActiveSupport::Logger.new($stdout)
103-
logger.formatter = config.log_formatter
104-
config.logger = ActiveSupport::TaggedLogging.new(logger)
105-
end
106-
10777
# Do not dump schema after migrations.
10878
config.active_record.dump_schema_after_migration = false
10979

11080
# Only use :id for inspections in production.
111-
# config.active_record.attributes_for_inspect = [:id]
81+
config.active_record.attributes_for_inspect = [:id]
11282

11383
# Enable DNS rebinding protection and other `Host` header attacks.
11484
# config.hosts = [
@@ -118,15 +88,4 @@
11888
#
11989
# Skip DNS rebinding protection for the default health check endpoint.
12090
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
121-
122-
# strategy for connection switching and pass that into the middleware through
123-
# these configuration options.
124-
# config.active_record.database_selector = { delay: 2.seconds }
125-
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
126-
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
127-
128-
# Action Cable endpoint configuration
129-
130-
config.action_cable.url = "wss://#{ENV.fetch('PRODUCTION_HOST', nil)}/cable"
131-
config.action_cable.allowed_request_origins = ["https://#{ENV.fetch('PRODUCTION_HOST', nil)}"]
13291
end

config/environments/test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
config.action_mailer.delivery_method = :test
4040

4141
# Set host to be used by links generated in mailer templates.
42-
# config.action_mailer.default_url_options = { host: "example.com" }
42+
config.action_mailer.default_url_options = { host: "example.com" }
4343

4444
# Print deprecation notices to the stderr.
4545
config.active_support.deprecation = :stderr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# frozen_string_literal: true
2+
3+
# Be sure to restart your server when you modify this file.
4+
#
5+
# This file contains migration options to ease your Rails 6.1 upgrade.
6+
#
7+
# Once upgraded flip defaults one by one to migrate to the new default.
8+
#
9+
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
10+
11+
# Support for inversing belongs_to -> has_many Active Record associations.
12+
# Rails.application.config.active_record.has_many_inversing = true
13+
14+
# Track Active Storage variants in the database.
15+
# Rails.application.config.active_storage.track_variants = true
16+
17+
# Apply random variation to the delay when retrying failed jobs.
18+
# Rails.application.config.active_job.retry_jitter = 0.15
19+
20+
# Stop executing `after_enqueue`/`after_perform` callbacks if
21+
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
22+
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
23+
24+
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
25+
#
26+
# This change is not backwards compatible with earlier Rails versions.
27+
# It's best enabled when your entire app is migrated and stable on 6.1.
28+
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
29+
30+
# Generate CSRF tokens that are encoded in URL-safe Base64.
31+
#
32+
# This change is not backwards compatible with earlier Rails versions.
33+
# It's best enabled when your entire app is migrated and stable on 6.1.
34+
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
35+
36+
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
37+
# UTC offset or a UTC time.
38+
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
39+
40+
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
41+
# requests to HTTPS in `ActionDispatch::SSL` middleware.
42+
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
43+
44+
# Make `form_with` generate non-remote forms by default.
45+
# Rails.application.config.action_view.form_with_generates_remote_forms = false
46+
47+
# Set the default queue name for the analysis job to the queue adapter default.
48+
# Rails.application.config.active_storage.queues.analysis = nil
49+
50+
# Set the default queue name for the purge job to the queue adapter default.
51+
# Rails.application.config.active_storage.queues.purge = nil
52+
53+
# Set the default queue name for the incineration job to the queue adapter default.
54+
# Rails.application.config.action_mailbox.queues.incineration = nil
55+
56+
# Set the default queue name for the routing job to the queue adapter default.
57+
# Rails.application.config.action_mailbox.queues.routing = nil
58+
59+
# Set the default queue name for the mail deliver job to the queue adapter default.
60+
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
61+
62+
# Generate a `Link` header that gives a hint to modern browsers about
63+
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
64+
# Rails.application.config.action_view.preload_links_header = true

0 commit comments

Comments
 (0)