[Dbix-class] Populating Instance With Column's Defaults

Pedro Melo melo at simplicidade.org
Wed Feb 9 11:11:29 GMT 2011


Hi,

On Wed, Feb 9, 2011 at 3:30 AM, Skye Shaw <skye.shaw at gmail.com> wrote:
> Hello,
>
> Is it possible to have DBIC populate a newly created instance with the
> underlying table's defaults when a value isn't provided?

One alternative you might consider is to move the defaults from the DB
to the DBIx::Class side, using this:

http://search.cpan.org/dist/DBIx-Class-DynamicDefault/lib/DBIx/Class/DynamicDefault.pm

I've done it on some projects, where I know that all the DB
creation/updates are done via my DBIx::Class schema, and it works
fine, specially because I could use the default values on HTML forms.

Bye,
-- 
Pedro Melo
http://www.simplicidade.org/
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org



More information about the DBIx-Class mailing list