aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-07-09 00:31:39 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-07-09 00:31:39 -0300
commit2253ebd3cef76db40acd32a414bf423f0a43a443 (patch)
treeaca1ab1d79885c451adf265b0afb967be1652b16
parenta55ed7f93e95770036381bd7ff9b29860bee7c80 (diff)
parent502d47d7f6b5bf9533676c44b9e325dc3feca3c0 (diff)
downloadrails-2253ebd3cef76db40acd32a414bf423f0a43a443.tar.gz
rails-2253ebd3cef76db40acd32a414bf423f0a43a443.tar.bz2
rails-2253ebd3cef76db40acd32a414bf423f0a43a443.zip
Merge pull request #10 from packagethief/doc-syntax
Fix CoffeeScript syntax in code examples
-rw-r--r--README.md6
-rw-r--r--lib/action_cable/server/broadcasting.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/README.md b/README.md
index f9c31c240f..efa3b52dc0 100644
--- a/README.md
+++ b/README.md
@@ -173,12 +173,12 @@ class WebNotificationsChannel < ApplicationCable::Channel
```coffeescript
# Somewhere in your app this is called, perhaps from a NewCommentJob
ActionCable.server.broadcast \
- "web_notifications_1", { title: 'New things!', body: 'All shit fit for print' }
+ "web_notifications_1", { title: 'New things!', body: 'All shit fit for print' }
# Client-side which assumes you've already requested the right to send web notifications
App.cable.subscriptions.create "WebNotificationsChannel",
- received: (data) ->
- web_notification = new Notification data['title'], body: data['body']
+ received: (data) ->
+ new Notification data['title'], body: data['body']
```
The `ActionCable.server.broadcast` call places a message in the Redis' pubsub queue under the broadcasting name of `web_notifications_1`.
diff --git a/lib/action_cable/server/broadcasting.rb b/lib/action_cable/server/broadcasting.rb
index de13e26511..4f72ffd96f 100644
--- a/lib/action_cable/server/broadcasting.rb
+++ b/lib/action_cable/server/broadcasting.rb
@@ -16,7 +16,7 @@ module ActionCable
# # Client-side coffescript which assumes you've already requested the right to send web notifications
# App.cable.subscriptions.create "WebNotificationsChannel",
# received: (data) ->
- # web_notification = new Notification data['title'], body: data['body']
+ # new Notification data['title'], body: data['body']
module Broadcasting
# Broadcast a hash directly to a named <tt>broadcasting</tt>. It'll automatically be JSON encoded.
def broadcast(broadcasting, message)