Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

by 1nickt (Canon)
on Oct 02, 2018 at 00:11 UTC ( [id://1223376]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1223376]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found