in reply to I need help adding a new model to a legacy Catalyst setup

The model name is $c->model('DB::OtherThing'), you just forgot the prefix. The other way to access it is with
my $db= $c->model('DB'); my $rs= $db->resultset('OtherThing');
This gives you the bare ResultSet object without wrapping it with a Catalyst model object, which sometimes makes error messages clearer.

For frequently used DBIC resultsets, it can be nice to add a convenience method to the application object (in Console.pm) like this:

sub otherthing { my $self= shift; my $rs= $self->model('DB')->resultset('OtherThing'); return @_? $rs->find(shift) : $rs }
Then you can call
$c->otherthing($id); # fetch an OtherThing row by primary key $c->otherthing->search_rs(...)->all # convenient access to resultset

There is no need to use the create scripts. I never do because it takes longer to remember the syntax for the create script and add my module boilerplate to the top of the file than to just "Save As" from the other file most like the one I want to create.

Replies are listed 'Best First'.
Re^2: I need help adding a new model to a legacy Catalyst setup
by LittleJack (Beadle) on Mar 20, 2022 at 20:11 UTC
    The model name is $c->model('DB::OtherThing'), you just forgot the prefix.

    So simple and yet it had my stumped for hours. Thank you so much.