跳到內文 跳到搜尋
方法
I

執行個體公開方法

identified_by(*identifiers)

使用連線識別索引標示一個鍵值,稍後即可用來再次找出特定連線。常見的識別碼為 current_user 和 current_account,但其實也可以是任何資料。

請注意,任何標示為識別碼的資料,在連線建立的任何頻道執行個體中都會自動建立同名委派。

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