C<belongs_to()> and maybe C<has_one()>.
=cut
use Mojo::Base -base;
use Mojo::IOLoop;
use Mojo::JSON ();
use Mojo::Loader 'load_class';
use Scalar::Util 'weaken';
use constant DEBUG => $ENV{MAD_DEBU
($self, $cb) = @_;
my @sql = $self->_delete_sql;
warn "[Mad::Mapper::delete] ", Mojo::JSON::encode_json(\@sql), "\n" if DEBUG;
if ($cb) {
weaken $self;
$self->db->query(
@sql,
per::has_many::$method] %s\n",
(!$fresh and $self->{cache}{$ck}) ? 'CACHED' : Mojo::JSON::encode_json(\@sql)
if DEBUG;
if ($cb) {
if ($fresh or !$self->{cache}{$ck}) {