Hi, 
 
I hope it's cool to post questions about this module on the DBIx Class list.  
I'm having trouble figuring out how to use this to create new entries in the 
database.  I was able to get it to edit existing ones without any trouble.  I 
can see in the source code that it's using 'insert_or_update' so I imagine that 
the intention at least is for this toe be able to create new entries. 
 
Here's my source (I'm using Catalyst): 
 
sub create :Path('create') Args(0) 
{ 
    my ($self, $c) = @_; 
     
        my $roles_rs  = $c->model('db::membership::roles'); 
         
        my $form = $self->role_form($c); 
        my $result    :Stashed; 
 
        if( $c->request->method eq 'GET' ) 
        {             
            ## Get the result object 
            $result    = $form->process(); 
        } 
        elsif($c->request->method eq 'POST') 
        { 
            ## Get the result object 
            $result = $form->process($c->request); 
             
            unless ($result->has_errors) 
            { 
                ##Put DB Data 
                $roles_rs->populate_from_widget($result); 
             
                ##Return to the list 
                $c->response->redirect('/roles'); 
            } 
        } 
} 
 
And the error I get is from Catalyst is: 
 
Caught exception in talentspace_portal2::Controller::roles->create "Can't 
locate object method "populate_from_widget" via package 
"talentspace::Schema::db::membership::roles::_resultset" at 
/mnt/hgfs/talentspace/talentspace_portal2/script/../lib/talentspace_portal2/Controller/roles.pm
 line 108." 
 
I get the feeling I need to do something with: 
 
my $roles_rs  = $c->model('db::membership::roles'); 
 
But all the stuff I tried, like ->search doesn't seem to help.  Has anyone run 
into this before and found the solution? BTW I'm using the version from CPAN 
labled '0.06'.
 
 
--john


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to