[jifty-devel] Easier model usage

Kang-min Liu gugod at gugod.org
Fri Aug 29 22:07:45 EDT 2008

Hi, All

I've been very frustrated to write something like:

my $m = Jifty->app_class(Model => "Foo")->new

Just to load a record, so I've come up with a Jifty::ModelHelpers
module that auto-generate
a method for each model and collection in the app. So you can write
this instead:

my $m = Foo(1);

For collections too:

my $foos = FooCollection;

This is equivalent of

my $foos = Jifty->app_class(Model => "FooCollection")->new;

Foo and FooCollection are auto-generated subs. The helper code is attached.

I would like you guys to tell me if something like this should be in
core. I'll make a release of such helper on my own
if not :)

Kang-min Liu
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ModelHelpers.pm
Url: http://lists.jifty.org/pipermail/jifty-devel/attachments/20080830/173dcd1b/attachment.txt 

More information about the jifty-devel mailing list