aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection/identification.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2015-07-11 11:25:11 +0200
committerDavid Heinemeier Hansson <david@loudthinking.com>2015-07-11 11:25:11 +0200
commitcbc73069788abc62fca5cf33ae5a0a4f63937fb1 (patch)
tree158d9f95384df1d1651d407a7319a7f175e904e9 /lib/action_cable/connection/identification.rb
parent763d499d9e7e5502c945e3bacfb02f573e9c2fdd (diff)
downloadrails-cbc73069788abc62fca5cf33ae5a0a4f63937fb1.tar.gz
rails-cbc73069788abc62fca5cf33ae5a0a4f63937fb1.tar.bz2
rails-cbc73069788abc62fca5cf33ae5a0a4f63937fb1.zip
Add automatic delegations from channel to connection identifiers
Diffstat (limited to 'lib/action_cable/connection/identification.rb')
-rw-r--r--lib/action_cable/connection/identification.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/action_cable/connection/identification.rb b/lib/action_cable/connection/identification.rb
index 3ea3b77e56..113e41ca3f 100644
--- a/lib/action_cable/connection/identification.rb
+++ b/lib/action_cable/connection/identification.rb
@@ -11,6 +11,9 @@ module ActionCable
class_methods do
# Mark a key as being a connection identifier index that can then used to find the specific connection again later.
# Common identifiers are current_user and current_account, but could be anything really.
+ #
+ # Note that anything marked as an identifier will automatically create a delegate by the same name on any
+ # channel instances created off the connection.
def identified_by(*identifiers)
Array(identifiers).each { |identifier| attr_accessor identifier }
self.identifiers += identifiers