12

I am using Rails 5 with actioncable and I am getting this error when trying send anything that throws actioncable What should i do? I'm trying to push the project to Heroku.

NoMethodError in MessagesController#create

undefined method `fetch' for nil:NilClass
Extracted source (around line #37):

#35       # Also makes sure proper dependencies are required.
#36       def pubsub_adapter
*37         adapter = (cable.fetch('adapter') { 'redis' })
#38         path_to_adapter = "action_cable/subscription_adapter/#{adapter}"
#39         begin
#40           require path_to_adapter

Extracted source (around line #50):

#48       # Adapter used for all streams/broadcasting.
#49       def pubsub
*50         @pubsub ||= config.pubsub_adapter.new(self)
#51       end
#52 
#53       # All the identifiers applied to the connection class associated with this server.

Extracted source (around line #42):

#40           def broadcast(message)
#41             server.logger.info "[ActionCable] Broadcasting to #{broadcasting}: #{message}"
*42             server.pubsub.broadcast broadcasting, ActiveSupport::JSON.encode(message)
#43           end
#44         end
#45     end


Rails.root: /media/adham/Data/code/rails5test

Application Trace
app/controllers/messages_controller.rb:6:in `create'
app/middleware/chat_action_cable.rb:10:in `call'
Nathaniel Ford
  • 20,545
  • 20
  • 91
  • 102
Adham El-Deeb
  • 335
  • 3
  • 16

1 Answers1

16

There was a commit made here: enter link description here

Reading through and changing the config file for ActionCable from...

config/redis/cable.yml

to

config/cable.yml

...fixed the issue. This update is to allow the ActionCable backend to be agnostic.

Rob Race
  • 196
  • 1
  • 4
  • 1
    Can someone explain why this happens ? It happened to me also with Rails 5.0.0.beta2 – ftshtw Feb 09 '16 at 13:03
  • They changed the configuration file to be more ambiguous to an ActionCable backend, instead of defaulting to Redis. – Rob Race Feb 18 '16 at 14:18