Refactor to use `model` instead of `record` as argument in Action Cable

We refer to `model` elsewhere in Action Cable's  implementation, so use
the same in `stream_or_reject_for` as well to keep the consistency.

Simplify the docs for the method to remove the usage "intention"
(that's not up to us) and mention it rejects the "subscription", not
the "connection".
This commit is contained in:
Carlos Antonio da Silva 2021-02-25 11:21:19 -03:00
parent a7e8e1a6d1
commit ca06a9ff41
1 changed files with 5 additions and 7 deletions

View File

@ -124,13 +124,11 @@ module ActionCable
end.clear end.clear
end end
# Calls stream_for if record is present, otherwise calls reject. # Calls stream_for with the given <tt>model</tt> if it's present to start streaming,
# This method is intended to be called when you're looking # otherwise rejects the subscription.
# for a record based on a parameter, if its found it will start def stream_or_reject_for(model)
# streaming. If the record is nil then it will reject the connection. if model
def stream_or_reject_for(record) stream_for model
if record
stream_for record
else else
reject reject
end end