Last active
March 17, 2022 08:21
-
-
Save nateberkopec/1184c81a92c10d84d779 to your computer and use it in GitHub Desktop.
ActionCable isn't *really* a Rails 5 dependency.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails new --skip-action-cable |
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
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.Normally, those version constraints would be managed for you by
rails.gemspec
.