跳至内容 跳至搜索
方法
I

实例公共方法

identified_by(*identifiers)

将键标记为连接标识符索引,以后可用于再次查找特定连接。常见标识符为 current_user 和 current_account,但实际上可以是任何内容。

请注意,标记为标识符的任何内容都会在从连接创建的任何频道实例上自动创建同名委托。

# File actioncable/lib/action_cable/connection/identification.rb, line 20
def identified_by(*identifiers)
  Array(identifiers).each { |identifier| attr_accessor identifier }
  self.identifiers += identifiers
end