aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-04-05 20:55:58 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-04-05 20:55:58 +0530
commit343e2647b39fa087444a94b6110e6d5809bc50eb (patch)
tree1680ab620933a9aa87ade2a10de5fb46a6fddf80 /guides
parentc89e6926a002c148af52d036f16c26f88a5f99d0 (diff)
downloadrails-343e2647b39fa087444a94b6110e6d5809bc50eb.tar.gz
rails-343e2647b39fa087444a94b6110e6d5809bc50eb.tar.bz2
rails-343e2647b39fa087444a94b6110e6d5809bc50eb.zip
[ci skip] Fix formatting of code snippet in Action Cable guide
Diffstat (limited to 'guides')
-rw-r--r--guides/source/action_cable_overview.md15
1 files changed, 8 insertions, 7 deletions
diff --git a/guides/source/action_cable_overview.md b/guides/source/action_cable_overview.md
index 28578b3369..8d95072e87 100644
--- a/guides/source/action_cable_overview.md
+++ b/guides/source/action_cable_overview.md
@@ -39,7 +39,7 @@ client-server connection instance established per WebSocket connection.
Connections form the foundation of the client-server relationship. For every WebSocket
the cable server is accepting, a Connection object will be instantiated on the server side.
-This instance becomes the parent of all the channel subscriptions that are created from there on.
+This instance becomes the parent of all the channel subscriptions that are created from there on.
The Connection itself does not deal with any specific application logic beyond authentication
and authorization. The client of a WebSocket connection is called a consumer. An individual
user will create one consumer-connection pair per browser tab, window, or device they have open.
@@ -73,12 +73,12 @@ end
```
Here `identified_by` is a connection identifier that can be used to find the
-specific connection later. Note that anything marked as an identifier will automatically
+specific connection later. Note that anything marked as an identifier will automatically
create a delegate by the same name on any channel instances created off the connection.
This example relies on the fact that you will already have handled authentication of the user
-somewhere else in your application, and that a successful authentication sets a signed
-cookie with the `user_id`.
+somewhere else in your application, and that a successful authentication sets a signed
+cookie with the `user_id`.
The cookie is then automatically sent to the connection instance when a new connection
is attempted, and you use that to set the `current_user`. By identifying the connection
@@ -89,8 +89,8 @@ or deauthorized).
### Channels
A channel encapsulates a logical unit of work, similar to what a controller does in a
-regular MVC setup. By default, Rails creates a parent `ApplicationCable::Channel` class
-for encapsulating shared logic between your channels.
+regular MVC setup. By default, Rails creates a parent `ApplicationCable::Channel` class
+for encapsulating shared logic between your channels.
#### Parent Channel Setup
@@ -150,7 +150,7 @@ established using the following Javascript, which is generated by default in Rai
App.cable = ActionCable.createConsumer()
```
-This will ready a consumer that'll connect against /cable on your server by default.
+This will ready a consumer that'll connect against /cable on your server by default.
The connection won't be established until you've also specified at least one subscription
you're interested in having.
@@ -215,6 +215,7 @@ If a consumer is not streaming (subscribed to a given channel), they'll not
get the broadcast should they connect later.
Broadcasts are called elsewhere in your Rails application:
+
```ruby
WebNotificationsChannel.broadcast_to current_user, title: 'New things!', body: 'All the news fit to print'
```