in reply to Dancer2, DBIx::Class and HTML::FormFu: showing database record in html-form to edit

Hi, search in scalar context returns the resultset, not a record. Try:

my $client = resultset('Client') ->search( { 'client_id' => $id }, { join => ['country'], } ) ->first;

(Also note the DBIx doc recommends use of prefetch rather than join when your join includes all the columns from the joined table.)

https://metacpan.org/pod/DBIx::Class::ResultSet#search
https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/Manual/Joining.pod#Whole-related-objects

Hope this helps!


The way forward always starts with a minimal test.
  • Comment on Re: Dancer2, DBIx::Class and HTML::FormFu: showing database record in html-form to edit
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Dancer2, DBIx::Class and HTML::FormFu: showing database record in html-form to edit
by GertMT (Hermit) on Oct 02, 2018 at 08:22 UTC
    Thanks for the answer and the helpful reference to the specific chapters in the documents!