[jifty-devel] How to override Create Update and Delete

Jesse Vincent jesse at bestpractical.com
Thu Dec 7 07:47:32 EST 2006




On Thu, Dec 07, 2006 at 02:27:58PM +0900, In-Suk Joung wrote:
>    I tried to override Jifty::Action::Record::CreateXxx (UpdateXxx or         
>    DeleteXxx) by creating the file CreateXxx.pm in /lib/MyApp/Action/.        
>    According to the class tree, they are different from other Action classes. 
>    So I constructed the skeleton like this:                                   
>                                                                               
>    use strict;                                                                
>    use warnings;                                                              
>                                                                               
>    package MyApp::Action::CreateXxx;                                          
>    use base qw/Jifty::Action::Record::Create MyWeblog::Model::Xxx/;           

We actually delegate to MyWeblog::Model::Xxx rather than inheriting from
it.


>                                                                               
>    1;                                                                         
>                                                                               
>    I thought this was good enough (although it does nothing right now). But   
>    it gave me bunch of errors when I tried to access the model, Xxx via       
>    administration menu. Deleting the file, it is ok.                          
>                                                                               
>    My questions are...                                                        
>    1. What is wrong?                                                          
>                                                                               
>    2. Is there a way to generate the skeleton automatically like we generate  
>    MyApp::Action::Xxx and MyApp::Model::Xxx using Jifty?                      

Not yet, but I'd love a patch to do it.  To see what boilerplate Jifty is
generating, have a look at Jifty::ClassLoader's insides.  It will show
you the source it's evalling into life. 

Best,
Jesse


More information about the jifty-devel mailing list