Class: ModelsChannel
- Inherits:
-
ActionCable::Channel::Base
- Object
- ActionCable::Channel::Base
- ModelsChannel
- Defined in:
- app/channels/models_channel.rb
Overview
Rails currently doesn’t allow namespacing channels in an engine module ActiveSync
Instance Method Summary collapse
-
#subscribed ⇒ Object
To change the data sent implement sync_record in the respective model.
- #unsubscribed ⇒ Object
Instance Method Details
#subscribed ⇒ Object
To change the data sent implement sync_record in the respective model
6 7 8 9 10 11 12 13 |
# File 'app/channels/models_channel.rb', line 6 def subscribed transmit(subscription_model.where(params[:filter]).map(&:sync_record)) stream_from params[:model], coder: ActiveSupport::JSON do || if (params[:filter].to_a - .to_a).blank? transmit([]) end end end |
#unsubscribed ⇒ Object
15 16 17 |
# File 'app/channels/models_channel.rb', line 15 def unsubscribed # Any cleanup needed when channel is unsubscribed end |