uninitialized constant > ActionCable::Server::Configuration::ApplicationCable

瘦欲@ 提交于 2019-11-30 18:18:26

The error is related to not having the correct ActionCable files in your project. You need app/channels/application_cable/channel.rb that looks like this

module ApplicationCable
  class Channel < ActionCable::Channel::Base
  end
end

and app/channels/application_cable/connection.rb

module ApplicationCable
  class Connection < ActionCable::Connection::Base
  end
end

I had the same problem when trying to use ActionCable with Rails 4.2.5 and the solution was to add the following to config/application.rb:

config.autoload_paths += %W(#{config.root}/app/channels)

This is with the ActionCable gem:

gem 'actioncable', github: 'rails/actioncable', branch: 'archive'

If you upgraded from previous version (when actioncable was not in the bundle), check if config/application.rb contains

require "action_cable/engine"

According to DHH's video tutorial from yesterday, there's an issue between Spring and an ActionCable dependency, so until the final release of Rails 5 you will need to recreate your project with the --skip-spring option.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!