diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2019-01-13 20:54:53 +0000 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2019-01-13 23:18:21 +0200 |
commit | c50930296be123e060d6a0a1df096f6af2a5d78a (patch) | |
tree | 15802f4d7324ea15f1ab2f03a59a5b41b0ee097a /guides | |
parent | 907b52885400bb740afc240c8cdf9de2c8432c19 (diff) | |
download | rails-c50930296be123e060d6a0a1df096f6af2a5d78a.tar.gz rails-c50930296be123e060d6a0a1df096f6af2a5d78a.tar.bz2 rails-c50930296be123e060d6a0a1df096f6af2a5d78a.zip |
Fix "Action Cable Overview" guide [ci skip]
Fix path to channel files.
`rails generate channel Chat` generates `app/javascript/channels/chat_channel.js`.
See also,
railties/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt,
actioncable/lib/rails/generators/channel/templates/javascript/index.js.tt
by default `application.js` imports "channels", where
`app/javascript/channels/index.js` loads all the channels within
this directory and all subdirectories.
Follow up #34709
Related to #33079
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/action_cable_overview.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/guides/source/action_cable_overview.md b/guides/source/action_cable_overview.md index 77a1b73bae..451ae3f03f 100644 --- a/guides/source/action_cable_overview.md +++ b/guides/source/action_cable_overview.md @@ -165,12 +165,12 @@ you're interested in having. A consumer becomes a subscriber by creating a subscription to a given channel: ```js -// app/javascript/cable/subscriptions/chat_channel.js +// app/javascript/channels/chat_channel.js import consumer from "./consumer" consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }) -// app/javascript/cable/subscriptions/appearance_channel.js +// app/javascript/channels/appearance_channel.js import consumer from "./consumer" consumer.subscriptions.create({ channel: "AppearanceChannel" }) @@ -183,7 +183,7 @@ A consumer can act as a subscriber to a given channel any number of times. For example, a consumer could subscribe to multiple chat rooms at the same time: ```js -// app/javascript/cable/subscriptions/chat_channel.js +// app/javascript/channels/chat_channel.js import consumer from "./consumer" consumer.subscriptions.create({ channel: "ChatChannel", room: "1st Room" }) @@ -261,7 +261,7 @@ connection is called a subscription. Incoming messages are then routed to these channel subscriptions based on an identifier sent by the cable consumer. ```js -// app/javascript/cable/subscriptions/chat_channel.js +// app/javascript/channels/chat_channel.js // Assumes you've already requested the right to send web notifications import consumer from "./consumer" @@ -305,7 +305,7 @@ An object passed as the first argument to `subscriptions.create` becomes the params hash in the cable channel. The keyword `channel` is required: ```js -// app/javascript/cable/subscriptions/chat_channel.js +// app/javascript/channels/chat_channel.js import consumer from "./consumer" consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, { @@ -359,7 +359,7 @@ end ``` ```js -// app/javascript/cable/subscriptions/chat_channel.js +// app/javascript/channels/chat_channel.js import consumer from "./consumer" const chatChannel = consumer.subscriptions.create({ channel: "ChatChannel", room: "Best Room" }, { @@ -419,7 +419,7 @@ appear/disappear API could be backed by Redis, a database, or whatever else. Create the client-side appearance channel subscription: ```js -// app/javascript/cable/subscriptions/appearance_channel.js +// app/javascript/channels/appearance_channel.js import consumer from "./consumer" consumer.subscriptions.create("AppearanceChannel", { @@ -534,7 +534,7 @@ end Create the client-side web notifications channel subscription: ```js -// app/javascript/cable/subscriptions/web_notifications_channel.js +// app/javascript/channels/web_notifications_channel.js // Client-side which assumes you've already requested // the right to send web notifications. import consumer from "./consumer" |