From d0023deb74c8093900f0d703bb5c68eb766e5bdd Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Tue, 12 Apr 2016 22:49:38 +0530 Subject: 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. --- .../lib/rails/generators/channel/templates/assets/cable.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 actioncable/lib/rails/generators/channel/templates/assets/cable.js (limited to 'actioncable/lib/rails/generators/channel/templates/assets') 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); -- cgit v1.2.3