Skip to content

Instantly share code, notes, and snippets.

@nateberkopec
Last active March 17, 2022 08:21
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save nateberkopec/1184c81a92c10d84d779 to your computer and use it in GitHub Desktop.
Save nateberkopec/1184c81a92c10d84d779 to your computer and use it in GitHub Desktop.
ActionCable isn't *really* a Rails 5 dependency.
# Existing applications upgrading to Rails 5 that don't want ActionCable
# config/application.rb
# require 'rails/all'
require "rails"
# same as rails/all.rb, but remove actioncable
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "action_cable/engine"
require "sprockets/railtie"
require "rails/test_unit/railtie"
# gem 'rails'
gem "activerecord"
gem "actionpack"
gem "actionview"
gem "actionmailer"
gem "activejob"
gem "activesupport"
gem "railties"
gem "sprockets-rails"
gem 'sqlite3'
# If you do this, you don't need to change config/application.rb.
# This has the side effect of not even *installing* ActionCable's gem dependencies.
# via @derekprior
rails new --skip-action-cable
@benoittgt
Copy link

:shipit:

@jaredbeck
Copy link

jaredbeck commented Jan 30, 2017

One disadvantage: you must now manage the version constraints of dependencies like sprockets-rails manually. For example, in a rails 5.0.1 app, use the following constraint.

- gem "sprockets-rails"
+ gem "sprockets-rails", ">= 2.0.0"

Normally, those version constraints would be managed for you by rails.gemspec.

@monfresh
Copy link

The Gemfile solution will only work if none of your dependencies have the rails gem as a dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment