Module: Redstream::Model

Defined in:
lib/redstream/model.rb

Overview

Include Redstream::Model in your model to stream the model’s updates via redis streams.

Examples:

class User < ActiveRecord::Base
  include Redstream::Model

  # ...

  redstream_callbacks
end

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

IVAR_DELAY_MESSAGE_ID =
:@__redstream_delay_message_id__

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



17
18
19
# File 'lib/redstream/model.rb', line 17

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#redstream_payloadObject

Override to customize the message payload. By default, the payload consists of the record id only (see example 1).

Examples:

Default

def redstream_payload
  { id: id }
end


64
65
66
# File 'lib/redstream/model.rb', line 64

def redstream_payload
  { id: id }
end