Skip to content
lyang edited this page Mar 19, 2013 · 5 revisions

Callbacks

Default callbacks

All models has the default ActiveRecord callbacks

(before|after)_validate
(before|around|after)_save
(before|around|after)_create
(before|around|after)_update
(before|around|after)_destroy

You can add custom logic for those callbacks. See here for details.

Special callbacks

Transaction object has special callbacks for their status changing methods.

(before|around|after)_submit_for_settlement
(before|around|after)_void
(before|around|after)_refund

Status validations are only run on those context. For example:

[:status, :inclusion => {:in => [Braintree::Transaction::Status::Authorized]}, :on => :submit_for_settlement],
[:status, :inclusion => {:in => [Braintree::Transaction::Status::Settled, Braintree::Transaction::Status::Settling]}, :on => :refund],
[:status, :inclusion => {:in => [Braintree::Transaction::Status::Authorized, Braintree::Transaction::Status::SubmittedForSettlement]}, :on => :void]
Clone this wiki locally