module Clear::Model::HasHooks

Direct including types

Defined in:

clear/model/modules/has_hooks.cr

Instance Method Summary

Macro Summary

Instance Method Detail

def has_trigger?(event_name : Symbol, direction : Symbol) #

Return whether there's at least a trigger connected to this event for this model.


[View source]
def trigger_after_events(event_name) #

Triggers the events hooked after event_name


[View source]
def trigger_before_events(event_name) #

Triggers the events hooked before event_name


[View source]
def with_triggers(event_name, &) #

This performs theses operations:

  • Call triggers before the event
  • Yield the given block
  • Call triggers after the event
model.with_triggers("email_sent") do |m|
  model.send_email
end

Returns self


[View source]

Macro Detail

macro after(event_name, method_name) #

[View source]
macro before(event_name, method_name) #

[View source]