On Wed, Nov 14, 2012 at 5:56 PM, Francisco Obispo <fobi...@isc.org> wrote:

> Use:
>
> $c->model('GUS::WebappSession') as the name.


So, it was a good suggestion after all ... it didn't work at first, and I
think this led me to (maybe) a possible fix

This doesn't work:

sub remove_sessions : Private {
  my ( $self, $c ) = @_;
  $c->delete_expired_sessions;
}

And this doesn't either:

sub remove_sessions : Private {
  my ( $self, $c ) = @_;
  my $model = $c->model('GUS::WebappSession');
  my $rs = $model->search(  { expires => { '<' , time() } } )->delete;
}

But this workaround did work:

sub remove_sessions : Private {
  my ( $self, $c ) = @_;
  my $model = $c->model('GUS::WebappSession');
  my $rs = $model->search(  { expires => { '<' , time() } } );
  while (my $session = $rs->next() ) {
    $session->delete;
  }
}

So, apparently the problem is calling delete() right on the resultset
object. For some reason that eludes me, DBIC is not fully qualifying the
table in this case.

Whereas when I call delete() on the DBIC::Class::Row? object it works.

Now looking back I guess I should have started all this fuss on the DBIC
mailing list :)

Folks, apologies for the cross-post, but I'm now moving the discussion to
its natural home.

For those interested here's the link to the complete thread:
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg13542.html

And here's the link to the RT ticket
https://rt.cpan.org/Ticket/Display.html?id=81179



-- 
fernan
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to