使用 ActionCable 将 rails 个应用程序部署到 Heroku

Deploy rails app with ActionCable to Heroku

我使用 ROR 和 ActionCable 创建了简单的在线聊天。 然后尝试将应用程序部署到 heroku。

但是我在部署后出现了一个奇怪的错误,应用程序不会 运行。

Heroku 构建日志:

   .........
   Bundle completed (0.70s)
   Cleaning up the bundler cache.
   Could not detect rake tasks
   ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
   and using the production group of your Gemfile.
   rake aborted!
   TypeError: nil is not a symbol
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `module_function'
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `<module:ActionCable>'
   /tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:22:in `<top (required)>'
   .........

action_cable.rb 来自 github:

  # Singleton instance of the server
  module_function def server       #line #29
    @server ||= ActionCable::Server::Base.new
  end

宝石文件

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

在本地机器上一切正常。 有任何想法吗?

出处,如有帮助:https://github.com/kokosko/chat/

这听起来像是 运行 ruby 2.0 或更低版本。 Rails 5.0 需要 ruby 2.2.

此错误消息的确切原因是在 ruby

的早期版本中
def foo
end

return 为零,而从 ruby 2.1 开始,它将 return :foo。您发布的代码依赖于此更改。