Ruby on Rails, ActionCable, Messages don't show up
<p>thanks for helping in advance!</p>
<p>I'm new to rails, and have been trying to follow this guide: <a href="https://www.youtube.com/watch?v=tyNepRO_ERc&amp;feature=youtu.be" rel="nofollow noreferrer">https://www.youtube.com/watch?v=tyNepRO_ERc&amp;feature=youtu.be</a></p>
<p>I've implemented ActionCable in the past before school got busy, and not without some trouble then--and now it is causing me trouble yet again.  I reach 17:00mins in that video with no problem, and everything makes sense--however when I send in the command it does not bring up any message.</p>
<p>So, what I do see:</p>
<p>&quot;hello world&quot; is showing up, but not any given input (not even upon reloading the page)</p>
<p><strong>First in my terminal:</strong></p>
<p>Started GET &quot;/cable&quot; for ::1 at 2016-05-23 21:45:00 -0600</p>
<p>Started GET &quot;/cable/&quot; [WebSocket] for ::1 at 2016-05-23 21:45:00 -0600</p>
<p>Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)</p>
<p>RoomChannel is transmitting the subscription confirmation</p>
<p>RoomChannel is streaming from room_channel</p>
<p>RoomChannel#speak({&quot;message&quot;=&gt;&quot;Travis: Neat!&quot;})</p>
<p>[ActionCable] Broadcasting to room_channel: &quot;Travis: Neat!&quot;</p>
<p>RoomChannel transmitting &quot;Travis: Neat!&quot; (via streamed from room_channel)</p>
<p><strong>Web Console:</strong></p>
<p>App.room.speak('Travis: Neat!')</p>
<p>true</p>
<p>I could post some code, I should post some code, but I am fairly sure that all of my code follows the video.  I'll be sorting through it for awhile still, I'm just more looking for any tips/insight/help for other ideas/things to check.  I've had a similar problem before in my previous attempts of implementing ActionCable, where the messages will even be sent in and processed, but not showing up until reloading the web page.</p>
<p>Thank you for any help,</p>
<p>... okay, I guess I better put some code first:</p>
<p>javascripts/channels/room.coffee</p>
<pre><code>App.room = App.cable.subscriptions.create &quot;RoomChannel&quot;,
# Called when the subscription is ready for use on the server
connected: -&gt;

# Called when the subscription has been terminated by the server
disconnected: -&gt;

# Called when there's incoming data on the websocket for this channel
received: (data) -&gt;
$('#messages').append &quot;&lt;div&gt;#{data}&lt;/div&gt;&quot;

speak: (message) -&gt;
@perform 'speak', message: message
</code></pre>
<p>javascripts/cable.coffee</p>
<pre><code>#= require action_cable
#= require_self
#= require_tree ./channels
#
@App ||= {}
App.cable = ActionCable.createConsumer()
</code></pre>
<p>channels/room_channel.rb</p>
<pre><code>class RoomChannel &lt; ApplicationCable::Channel
  def subscribed
    stream_from &quot;room_channel&quot;
  end

  def unsubscribed
    # Any cleanup needed when channel is unsubscribed
  end

  def speak(data)
    ActionCable.server.broadcast 'room_channel', data['message']
  end
end
</code></pre>
<p>/controllers/rooms_controller.rb</p>
<pre><code>class RoomsController &lt; ApplicationController
  def show
    @messages = Message.all
  end
end
</code></pre>
<p>/models/message.rb</p>
<pre><code>class Message &lt; ApplicationRecord
    after_create_commit { BroadcastMessageJob.perform_later self  }
end
</code></pre>
<p>/views/messages/_message.html.erb</p>
<pre><code>&lt;p&gt; &lt;%= message.content %&gt; &lt;/p&gt;
</code></pre>
<p>/views/rooms/show.html.erb</p>
<pre><code>&lt;h1&gt;ActionCable Chat&lt;/h1&gt;

    &lt;%= render @messages %&gt;
</code></pre>
<p>/config/environments/development.rb
(Here I have inserted this line, which actually fixed the problem for me last time I tried using ActionCable months ago)</p>
<pre><code>ActionCable.server.config.disable_request_forgery_protection = true
</code></pre>
<p>/config/cable.yml</p>
<pre><code>production:
  adapter: redis
  url: redis://localhost:6379/1
</code></pre>
<p>/config/database.yml</p>
<pre><code>default: &amp;default
  adapter: postgresql
  encoding: unicode
  pool: 5
  timeout: 5000
development:
  &lt;&lt;: *default
  database: [InsertNameOfMyAppHere]_development
</code></pre>
<p>Honestly, I know, my Gemfile is a mess:</p>
<pre><code>   ruby '2.3.1'
    source 'https://rubygems.org'
    
    
    # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
    gem 'rails','&gt;= 5.0.0.rc1'
    gem 'pg'
    # Use sqlite3 as the database for Active Record
    
    #gem 'sqlite3'
    # Use SCSS for stylesheets
    gem 'sass-rails', '~&gt; 5.0'
    # Use Uglifier as compressor for JavaScript assets
    gem 'uglifier', '&gt;= 1.3.0'
    # Use CoffeeScript for .coffee assets and views
    gem 'coffee-rails', '~&gt; 4.1'
    # See https://github.com/rails/execjs#readme for more supported runtimes
    # gem 'therubyracer', platforms: :ruby
    
    # Use jquery as the JavaScript library
    gem 'jquery-rails'
    # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
    gem 'turbolinks'
    # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
    gem 'jbuilder', '~&gt; 2.0'
    # bundle exec rake doc:rails generates the API under doc/api.
    gem 'sdoc', '~&gt; 0.4.0', group: :doc
    
    # Use ActiveModel has_secure_password
    # gem 'bcrypt', '~&gt; 3.1.7'
    
    # Use Unicorn as the app server
    # gem 'unicorn'
    
    # Use Capistrano for deployment
    # gem 'capistrano-rails', group: :development
    
    group :development, :test do
      # Call 'byebug' anywhere in the code to stop execution and get a debugger console
      gem 'byebug'
    end
    
    group :development do
      # Access an IRB console on exception pages or by using &lt;%= console %&gt; in views
      gem 'web-console', '~&gt; 2.0'
    
      # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
      gem 'spring'
    end
    
    gem 'devise', '&gt;= 4.0.0.rc1'
    gem 'sass', '~&gt; 3.4', '&gt;= 3.4.20'
    gem 'acts_as_votable', '~&gt; 0.10.0'
    #comments/discussions:
    gem 'simple_form', '~&gt; 3.2', '&gt;= 3.2.1'
    gem 'puma'
    gem 'actioncable', '~&gt; 5.0.0.rc1'
    gem 'therubyracer'
    gem 'execjs'
    gem 'record_tag_helper'
    gem 'redis' 
</code></pre>
<p>My terminal upon starting the server</p>
<pre><code>Array values in the parameter to `Gem.paths=` are deprecated.
Please use a String or nil.
An Array ({&quot;GEM_PATH&quot;=&gt;[&quot;/Users/Kegan/.rvm/gems/ruby-2.3.1&quot;, &quot;/Users/Kegan/.rvm/gems/ruby-2.3.1@global&quot;]}) was passed in from bin/rails:3:in `load'
=&gt; Booting Puma
=&gt; Rails 5.0.0.rc1 application starting in development on http://localhost:3000
=&gt; Run `rails server -h` for more startup options
[Simple Form] Simple Form is not configured in the application and will use the default values. Use `rails generate simple_form:install` to generate the Simple Form configuration.
Puma starting in single mode...
* Version 3.4.0 (ruby 2.3.1-p112), codename:
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
</code></pre>
<p>[In response to Graham Slick]</p>
<p>App.room.speak(‘Does This Work?’)
true</p>
<p>———————————————————————</p>
<p>Does This Work?</p>
<p>———————————————————————</p>
<p>Added Code: (Javascripts/channels/room.coffee)</p>
<pre><code>  received: (data) -&gt;
    console.log(data)
    $('#messages').append &quot;&lt;div&gt;#{data}&lt;/div&gt;&quot;
</code></pre>