Skip to content

Instantly share code, notes, and snippets.

@parndt
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parndt/4482a686324d8de3782a to your computer and use it in GitHub Desktop.
Save parndt/4482a686324d8de3782a to your computer and use it in GitHub Desktop.
Rails 4.1 -> 4.2 upgrade (important stuff) diff
diff --git a/Gemfile b/Gemfile
index 71f3511..6746bc9 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@ source "https://rubygems.org"
ruby "2.2.0"
# Bundle edge Rails instead: gem "rails", github: "rails/rails"
-gem "rails", "4.1.9"
+gem "rails", "~> 4.2.0"
# Use postgresql as the database for Active Record
gem "pg"
# Use SCSS for stylesheets
diff --git a/config/application.rb b/config/application.rb
index 991403a..e4953ea 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -25,5 +25,8 @@ module ExampleApp
plugins.find_by_name("refinery_settings").hide_from_menu = true
end
end
+
+ # Do not swallow errors in after_commit/after_rollback callbacks.
+ config.active_record.raise_in_transactional_callbacks = true
end
end
diff --git a/config/boot.rb b/config/boot.rb
index 5e5f0c1..6b750f0 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,4 +1,3 @@
-# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 873dbef..42a574b 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -36,4 +36,8 @@ Rails.application.configure do
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = 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
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index a4d8faf..923bed7 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -20,7 +20,7 @@ Rails.application.configure do
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@@ -29,20 +29,22 @@ Rails.application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = true
- # Generate digests for assets URLs.
+ # 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
# Specifies the header that your server uses for sending files.
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- # Set to :debug to see everything in the log.
- config.log_level = :info
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
@@ -69,9 +71,6 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Disable automatic flushing of the log to improve performance.
- # config.autoflush_log = false
-
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
diff --git a/config/environments/test.rb b/config/environments/test.rb
index b8b796e..d27836e 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -13,7 +13,7 @@ Rails.application.configure do
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
- config.serve_static_assets = true
+ config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index d2f4ec3..01ef3e6 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -3,6 +3,9 @@
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
+# Add additional assets to the asset load path
+# Rails.application.config.assets.paths << Emoji.images_path
+
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
index 7a06a89..7f70458 100644
--- a/config/initializers/cookies_serializer.rb
+++ b/config/initializers/cookies_serializer.rb
@@ -1,3 +1,3 @@
# Be sure to restart your server when you modify this file.
-Rails.application.config.action_dispatch.cookies_serializer = :json
\ No newline at end of file
+Rails.application.config.action_dispatch.cookies_serializer = :json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment