Skip to content

annotation Athena::ORM::Annotations::PostPersist #

Marks a method to be called after the entity is inserted, during AORM::EntityManager#flush. Database generated identifiers are available by then.

@[AORMA::PostPersist]
def send_welcome_email(event : AORM::Events::PostPersistEventArgs(User)) : Nil
  # ...
end

See AORMA::PrePersist for the rules every lifecycle callback follows. Changes to the entity made by the callback aren't written by the current flush.