[jifty-devel] Struggling with Jifty
Ruslan Zakirov
ruz at bestpractical.com
Sun May 16 14:30:01 EDT 2010
[snip]
>> 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.
Jifty->app_class('Model::Post');
Instead the folling code can be used.
Jifty->app_class('Model::Post')->new;
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
application.
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.
>
> Rgds
> --S
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
--
Best regards, Ruslan.
More information about the jifty-devel
mailing list