<font size=2 face="sans-serif">Here are the two relationships predefined
in the account.pm file:</font>
<br>
<br><font size=2 face="sans-serif">__PACKAGE__-&gt;belongs_to(</font>
<br><font size=2 face="sans-serif">&nbsp; &quot;account_id&quot;,</font>
<br><font size=2 face="sans-serif">&nbsp; &quot;dbms::Schema::Result::Account&quot;,</font>
<br><font size=2 face="sans-serif">&nbsp; { account_id =&gt; &quot;account_id&quot;
},</font>
<br><font size=2 face="sans-serif">);</font>
<br>
<br><font size=2 face="sans-serif">=head2 accounts</font>
<br>
<br><font size=2 face="sans-serif">Type: has_many</font>
<br>
<br><font size=2 face="sans-serif">Related object: L&lt;dbms::Schema::Result::Account&gt;</font>
<br>
<br><font size=2 face="sans-serif">=cut</font>
<br>
<br><font size=2 face="sans-serif">__PACKAGE__-&gt;has_many(</font>
<br><font size=2 face="sans-serif">&nbsp; &quot;accounts&quot;,</font>
<br><font size=2 face="sans-serif">&nbsp; &quot;dbms::Schema::Result::Account&quot;,</font>
<br><font size=2 face="sans-serif">&nbsp; { &quot;foreign.account_id&quot;
=&gt; &quot;self.account_id&quot; },</font>
<br><font size=2 face="sans-serif">&nbsp; {},</font>
<br><font size=2 face="sans-serif">);</font>
<br><font size=2 face="sans-serif">&nbsp;</font>
<br><font size=2 face="sans-serif">So you're saying I should do this:</font>
<br>
<br><font size=2 face="sans-serif">__PACKAGE__-&gt;belongs_to(</font>
<br><font size=2 face="sans-serif">&nbsp; &quot;account&quot;,</font>
<br><font size=2 face="sans-serif">&nbsp; &quot;dbms::Schema::Result::Account&quot;,</font>
<br><font size=2 face="sans-serif">&nbsp; { account_id =&gt; &quot;account_id&quot;
},</font>
<br><font size=2 face="sans-serif">);</font>
<br>
<br><font size=2 face="sans-serif">?</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">From:</font>
<td><font size=1 face="sans-serif">Will Crawford &lt;billcrawford1970@gmail.com&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">To:</font>
<td><font size=1 face="sans-serif">The elegant MVC web framework &lt;catalyst@lists.scsys.co.uk&gt;</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Date:</font>
<td><font size=1 face="sans-serif">05/08/2012 10:49 AM</font>
<tr valign=top>
<td><font size=1 color=#5f5f5f face="sans-serif">Subject:</font>
<td><font size=1 face="sans-serif">Re: [Catalyst] Getting hashref instead
of value</font></table>
<br>
<hr noshade>
<br>
<br>
<br><font size=3><br>
</font>
<br><font size=3>On 8 May 2012 16:44, Kenneth S Mclane &lt;</font><a href=mailto:ksmclane@us.ibm.com target=_blank><font size=3 color=blue><u>ksmclane@us.ibm.com</u></font></a><font size=3>&gt;
wrote:</font>
<br><font size=3 face="sans-serif">The Catalyst helper script created most
of the relationships. I added a few at the bottom of the Account.pm file
to since there are a bunch of them based on &quot;account_id&quot;, so
I made them myself and gave them different names. progress, metrics, compliance
are ones I did. the one called &quot;department_id&quot; was created by
the helper and I didn&quot;t want to chang it. I guess I could redefine
it below with a different name. Strangely, the account table has a belongs
to AND a has many to itself based on the account_id field. I am actually
looking to get a list nad that is what I get except for the one field.</font><font size=3>
</font>
<br>
<br><font size=3>Basically you just need to rename the relationship to
call the accessor &quot;account&quot; instead of &quot;account_id&quot;,
so that .account_id refers to the raw ID column, not the object.</font><tt><font size=2>_______________________________________________<br>
List: Catalyst@lists.scsys.co.uk<br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</font></tt></a><tt><font size=2><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</font></tt></a><tt><font size=2><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2>http://dev.catalyst.perl.org/</font></tt></a><tt><font size=2><br>
</font></tt>
<br>
<br>