Skip to content

Commit

Permalink
Upgrade to Rails 6
Browse files Browse the repository at this point in the history
* Bumps main dependencies,
* Upgrades the example app.
  • Loading branch information
dependabot-preview[bot] authored and nickcharlton committed Sep 10, 2019
1 parent 0ecb1ba commit 1343c5a
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 88 deletions.
48 changes: 24 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,33 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
actionpack (6.0.0)
actionview (= 6.0.0)
activesupport (= 6.0.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.3)
activesupport (= 5.2.3)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (6.0.0)
activesupport (= 6.0.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.3)
activesupport (= 5.2.3)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.0)
activesupport (= 6.0.0)
globalid (>= 0.3.6)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activesupport (5.2.3)
activemodel (6.0.0)
activesupport (= 6.0.0)
activerecord (6.0.0)
activemodel (= 6.0.0)
activesupport (= 6.0.0)
activesupport (6.0.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.1, >= 2.1.8)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
administrate-field-image (1.1.0)
Expand All @@ -56,7 +56,6 @@ GEM
bundler
rake
thor (>= 0.14.0)
arel (9.0.0)
ast (2.4.0)
autoprefixer-rails (9.6.1.1)
execjs
Expand Down Expand Up @@ -173,18 +172,18 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.1.0)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
rails-i18n (5.1.3)
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 5.0, < 6)
railties (>= 6.0.0, < 7)
rails_stdout_logging (0.0.5)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
railties (6.0.0)
actionpack (= 6.0.0)
activesupport (= 6.0.0)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
raindrops (0.19.0)
rake (12.3.3)
Expand Down Expand Up @@ -252,6 +251,7 @@ GEM
websocket-extensions (0.1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.1.9)

PLATFORMS
ruby
Expand Down
16 changes: 2 additions & 14 deletions spec/example_app/config/application.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../boot', __FILE__)
require File.expand_path("boot", __dir__)

require "active_model/railtie"
require "active_record/railtie"
Expand Down Expand Up @@ -27,25 +27,13 @@ class Application < Rails::Application

config.action_controller.action_on_unpermitted_parameters = :raise

# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de

if Rails::VERSION::MAJOR < 5
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end

if Rails::VERSION::MAJOR >= 5
config.active_record.time_zone_aware_types = [:datetime, :time]
config.active_record.time_zone_aware_types = %i(datetime time)
end
end
end
2 changes: 1 addition & 1 deletion spec/example_app/config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Load the Rails application.
require File.expand_path('../application', __FILE__)
require_relative "application"

# Initialize the Rails application.
Rails.application.initialize!
18 changes: 8 additions & 10 deletions spec/example_app/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,27 @@
config.eager_load = false

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true

# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Suppress logger output for asset requests.
config.assets.quiet = true

# Raises error for missing translations
# Raises error for missing translations.
config.action_view.raise_on_missing_translations = true
end
42 changes: 19 additions & 23 deletions spec/example_app/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,23 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true

# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Ensures that a master key has been made available in either
# ENV["RAILS_MASTER_KEY"] or in config/master.key. This key is used to
# decrypt credentials (and other encrypted files).
# config.require_master_key = true

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.static_cache_control = "public, max-age=#{1.year.to_i}"
# Enable deflate / gzip compression of controller-generated responses
config.middleware.use Rack::Deflater
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass

# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true

# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'

# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
Expand All @@ -52,17 +44,15 @@
config.log_level = :debug

# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]

# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
config.log_tags = [:request_id]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Use a real queuing backend for Active Job (and separate queues per
# environment).
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "administrate_prototype_production"

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
Expand All @@ -74,6 +64,12 @@
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
25 changes: 12 additions & 13 deletions spec/example_app/config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.application.configure do
config.cache_classes = true

# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false

# Configure static file server for tests with Cache-Control for performance.
# Configure public file server for tests with Cache-Control for performance.
if config.respond_to?(:public_file_server)
config.public_file_server.enabled = true
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=3600",
}
else
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
config.static_cache_control = "public, max-age=3600"
end

# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.cache_store = :null_store

# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false

# Randomize the order test cases are executed.
config.active_support.test_order = :random

# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr

# Raises error for missing translations
# Raises error for missing translations.
config.action_view.raise_on_missing_translations = true
end
2 changes: 1 addition & 1 deletion spec/example_app/config/initializers/cookies_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.

Rails.application.config.action_dispatch.cookies_serializer = :json
Rails.application.config.action_dispatch.cookies_serializer = :marshal
4 changes: 2 additions & 2 deletions spec/example_app/config/initializers/wrap_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
wrap_parameters format: [:json]
end

# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# self.include_root_in_json = true
# end

0 comments on commit 1343c5a

Please sign in to comment.