aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/rails/generators/channel/templates
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-04-12 22:49:38 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-04-12 22:49:38 +0530
commitd0023deb74c8093900f0d703bb5c68eb766e5bdd (patch)
treeac4d9b5457f027774854c66317d53a71fa359fb9 /actioncable/lib/rails/generators/channel/templates
parentdb9bc8097399aab9c866175b12e9e099b6c83ffa (diff)
downloadrails-d0023deb74c8093900f0d703bb5c68eb766e5bdd.tar.gz
rails-d0023deb74c8093900f0d703bb5c68eb766e5bdd.tar.bz2
rails-d0023deb74c8093900f0d703bb5c68eb766e5bdd.zip
Generate `cable.js` file if does not exist when generating channel
- Before this, while generating a channel, we were not creating `cable.js` if it does not already exist. - We have similar code for application mailer here - https://github.com/rails/rails/commit/0b3ae023d27197417541932632055cd6be4810c4. - Based on the comment - https://github.com/rails/rails/issues/24418#issuecomment-205421995.
Diffstat (limited to 'actioncable/lib/rails/generators/channel/templates')
-rw-r--r--actioncable/lib/rails/generators/channel/templates/assets/cable.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/actioncable/lib/rails/generators/channel/templates/assets/cable.js b/actioncable/lib/rails/generators/channel/templates/assets/cable.js
new file mode 100644
index 0000000000..71ee1e66de
--- /dev/null
+++ b/actioncable/lib/rails/generators/channel/templates/assets/cable.js
@@ -0,0 +1,13 @@
+// Action Cable provides the framework to deal with WebSockets in Rails.
+// You can generate new channels where WebSocket features live using the rails generate channel command.
+//
+//= require action_cable
+//= require_self
+//= require_tree ./channels
+
+(function() {
+ this.App || (this.App = {});
+
+ App.cable = ActionCable.createConsumer();
+
+}).call(this);