Help language development. Donate to The Perl Foundation
use v6.d; use lib 'lib'; use ORM::ActiveRecord::Model; use Test; class Client is Model { submethod BUILD { self.validate: 'email', { :presence }; self.before-save: -> { self.lowercase-email }; } method lowercase-email { self.email .= lc; } } plan 2; %*ENV<DISABLE-SQL-LOG> = True; my $client = Client.create({ email => '[email protected]' }); ok $client.email eq '[email protected]'; $client.email = '[email protected]'; $client.save; ok $client.email eq '[email protected]'; Client.destroy-all;