aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2017-11-13 15:23:28 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-11-13 15:23:28 -0500
commit8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2 (patch)
tree9830dad2b5514f9c1600036a81433266ddec3250 /actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt
parent705cf47033afabf4530a209f907ff4bf35acf2c2 (diff)
downloadrails-8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2.tar.gz
rails-8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2.tar.bz2
rails-8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2.zip
Use .tt extension to all the template files
Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
Diffstat (limited to 'actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt')
-rw-r--r--actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt14
1 files changed, 14 insertions, 0 deletions
diff --git a/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt
new file mode 100644
index 0000000000..5467811aba
--- /dev/null
+++ b/actioncable/lib/rails/generators/channel/templates/assets/channel.coffee.tt
@@ -0,0 +1,14 @@
+App.<%= class_name.underscore %> = App.cable.subscriptions.create "<%= class_name %>Channel",
+ connected: ->
+ # Called when the subscription is ready for use on the server
+
+ disconnected: ->
+ # Called when the subscription has been terminated by the server
+
+ received: (data) ->
+ # Called when there's incoming data on the websocket for this channel
+<% actions.each do |action| -%>
+
+ <%= action %>: ->
+ @perform '<%= action %>'
+<% end -%>