Class: Activity::SynchronousEffectsHandler

Inherits:
Object
  • Object
show all
Defined in:
app/subscribers/activity/synchronous_effects_handler.rb

Overview

Handles the two Activity behaviors that MUST run synchronously inside the
request cycle because they write to the virtual attribute
activity.chained_activity_result, which ActivitiesController reads
immediately after activity.save to render newly-created chained activities
in the UI response.

All other post-create / post-update effects (emails, assignment notifications,
type-rule execution, sales-activity checks) are handled by after-commit event
subscribers registered in config/initializers/event_store.rb.

Called from Activity model after_create / after_update callbacks (inside the
with_options(unless: :skip_callbacks) block).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#activityObject (readonly)

Returns the value of attribute activity.



16
17
18
# File 'app/subscribers/activity/synchronous_effects_handler.rb', line 16

def activity
  @activity
end

Instance Method Details

#after_create(activity) ⇒ Object



18
19
20
21
22
# File 'app/subscribers/activity/synchronous_effects_handler.rb', line 18

def after_create(activity)
  @activity = activity
  update_support_case_status
  execute_chain if execute_chain?
end

#after_update(activity) ⇒ Object



24
25
26
27
28
# File 'app/subscribers/activity/synchronous_effects_handler.rb', line 24

def after_update(activity)
  @activity = activity
  update_support_case_status
  execute_chain if execute_chain?
end