rails: Rails 5 beta 3: Cannot read property 'subscriptions' of undefined

Ruby 2.2.3

rails g channel foo_bar speak

Enabled cable in router, then restart server. Now got:

Cannot read property ‘subscriptions’ of undefined

which point to:

(function() {
  App.foo_bar = App.cable.subscriptions.create("FooBarChannel", {
    connected: function() {},
    disconnected: function() {},
    received: function(data) {},
    request: function() {
      return this.perform('speak');
    }
  });

}).call(this);

And:

Uncaught SyntaxError: Failed to construct

this.webSocket = new WebSocket(this.consumer.url);

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Yes. By default the action_cable_meta_tag is present in application.html.erb. If you are using that layout then the page source should contain the meta tag as follows -

actioncablejsapp 2016-04-05 17-30-34