[Catalyst] Reaction objects and DWIM for default => sub {...}

Guillermo Roditi groditi at gmail.com
Tue Jan 23 22:51:36 GMT 2007


i'd like the following to DWIM when I use CRUDController. is there a way to
do it already or should i go hit up the source?
and if im hitting thesource.. what am i hitting up ViewPort::ActionForm?
Field::DateTime?
 wtf mate?

bold section highlighted.
DWIM means when i am presented with a field on create to be prefilled with
the default value or if left blank to use that.. either works.


...
use DBIx::Class 0.07;
use DateTime;

use base 'DBIx::Class';
use Reaction::Class;
use Reaction::Types::DateTime;

...
has created_d  =3D> (is =3D> 'rw', required =3D> 1, isa =3D> 'DateTime',
                   default =3D> sub{ DateTime->now } );

__PACKAGE__->load_components(qw(InflateColumn::DateTime Core ));

__PACKAGE__->table("users");
__PACKAGE__->add_columns
    (...
     "created_d" =3D> {
                     data_type =3D> "DATETIME",
                     default_value =3D> sub{ DateTime->now },  #this doesnt
work either :(
                     is_nullable =3D> 0,
                     size =3D> 19
                    },
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070123/f404c=
348/attachment-0001.htm


More information about the Catalyst mailing list