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

Guillermo Roditi groditi at gmail.com
Wed Jan 24 00:29:26 GMT 2007


I even tried using this:
...
has created_d  =3D> (is =3D> 'rw', required =3D> 1, isa =3D> 'DateTime',
                   default =3D> sub{ exit 0; } )

...

and nothing happened. why is the default case not happening? is this related
to set_or_lazy_build? It seems like it could be incredibly useful
functionality for ActionReflector to support.



On 1/23/07, Guillermo Roditi <groditi at gmail.com> wrote:
>
> 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 does=
nt
> 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/525ce=
3ef/attachment.htm


More information about the Catalyst mailing list