[jifty-devel] Struggling with Jifty
ruz at bestpractical.com
Sun May 16 14:30:01 EDT 2010
>> I changed "new_action(class => 'UpdatePost', record => $post);" to
>> "new JiftyDemo::Model::Post;" and it works perfectly.
> "Jifty->app_class('Model::Post');" with "new JiftyDemo::Model::Post;"
> to be exact.
Sorry, it was my mistake. I didn't test code. The following code
returns class name and makes sure it's loaded. ->new is missing part
as you need object instead of class.
Instead the folling code can be used.
Sure, your current code that works for you is correct and equal to
above line. I just find app_class method better long term, for example
if you will want rename application or re-use code in another
So at the end the following lines are very similar:
my $obj = App::Class::Model::X->new;
my $obj = new App::Class::Model::X;
my $obj = Jifty->app_class('Model::X')->new;
> Probably the "there is more than one way to ..." thing.
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
Best regards, Ruslan.
More information about the jifty-devel