<div dir="ltr">Ok, I have an explanation.<div><br></div><div>We did a release and App::DB::ResultSet::UserRole is a new class.   But, we cache User objects in Memcached (as a DBIC row).</div><div><br></div><div>And the old code did this:</div><div><br></div><div>    $user-&gt;search_related( &#39;user_role&#39;, { ... } );</div><div><br></div><div>which then populated $user-&gt;{related_resultsets}{user_role} with the (default?) App::DB::Result class instance (and saved it in Memcached).</div><div><br></div><div>So, when we rolled out the new code it was using cached $user objects so $user-&gt;{related_resultsets}{user_role} was the base ResultSet object which didn&#39;t have the &quot;my_method&quot; method.</div><div><br></div><div>So, it may be as simple as delete $user-&gt;{related_resultsets} after fetching the $user object from cache.   Can&#39;t be that expensive to look up the relationships.</div><div><br></div><div>Or we could be disruptive and blow away the cache at release time.   But, it&#39;s not a problem that happens very often.</div><div><br></div><div><br></div><div>I wonder if it makes sense for DBIC to not save related_resultset in objects if there isn&#39;t a specific one -- which would have prevented this.   Seems like quite an edge-case.</div><div><br></div><div><br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 15, 2015 at 4:45 PM, Bill Moseley <span dir="ltr">&lt;<a href="mailto:moseley@hank.org" target="_blank">moseley@hank.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Jul 15, 2015 at 3:15 PM, Francisco Obispo <span dir="ltr">&lt;<a href="mailto:francisco@obispo.link" target="_blank">francisco@obispo.link</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">The result of<br>
<br>
$self-&gt;related_resultset( &#39;user_role&#39; )<br>
<br>
is a App::DB::ResultSet<br></blockquote><div><br></div></span><div>But it should return an App::DB::ResultSet::UserRole object.  &quot;my_method&quot; is in the App::DB::ResultSet::UserRole class.</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="color:rgb(80,0,80)">return $self-&gt;related_resultset( &#39;user_role&#39; )-&gt;my_method-&gt;count &gt; 0;</span></blockquote><div><br></div></span><div>When I printed Dumper $self-&gt;{related_resultsets} (in the related_resultset() method) when it was NOT working I was getting:</div><div><br></div><div><i>Note the class:</i></div><div><br></div><div><div>          &#39;user_role&#39; =&gt; bless( {</div><div>                                  &#39;pager&#39; =&gt; undef,</div><div>                                  &#39;attrs&#39; =&gt; {</div><div>                                               &#39;is_depends_on&#39; =&gt; 0,</div><div>                                               &#39;cascade_copy&#39; =&gt; 0,</div><div>                                               &#39;accessor&#39; =&gt; &#39;multi&#39;,</div><div>                                               &#39;alias&#39; =&gt; &#39;me&#39;,</div><div>                                               &#39;bind&#39; =&gt; &#39;ARRAY(0x7fdf9ac59198)&#39;,</div><div>                                               &#39;join_type&#39; =&gt; &#39;LEFT&#39;,</div><div>                                               &#39;where&#39; =&gt; &#39;HASH(0x7fdf9ac58fd0)&#39;,</div><div>                                               &#39;cascade_delete&#39; =&gt; 0</div><div>                                             },</div><div>                                  &#39;cond&#39; =&gt; $VAR1-&gt;{&#39;user_role&#39;}{&#39;attrs&#39;}{&#39;where&#39;},</div><div>                                  &#39;_result_class&#39; =&gt; &#39;App::DB::Result::UserRole&#39;,</div><div>                                  &#39;result_source&#39; =&gt; bless( {</div><div>                                                              &#39;_columns&#39; =&gt; &#39;HASH(0x7fdf85857f40)&#39;,</div><div>                                                              &#39;schema&#39; =&gt; $VAR1-&gt;{&#39;user_pref&#39;}{&#39;result_source&#39;}{&#39;schema&#39;},</div><div>                                                              &#39;_unique_constraints&#39; =&gt; &#39;HASH(0x7fdf9696ffc8)&#39;,</div><div>                                                              &#39;_relationships&#39; =&gt; &#39;HASH(0x7fdf8585b0f8)&#39;,</div><div>                                                              &#39;result_class&#39; =&gt; &#39;Appi::DB::Result::UserRole&#39;,</div><div>                                                              &#39;source_name&#39; =&gt; &#39;UserRole&#39;,</div><div>                                                              &#39;resultset_class&#39; =&gt; &#39;App::DB::ResultSet::UserRole&#39;,</div><div>                                                              &#39;_columns_info_loaded&#39; =&gt; 0,</div><div>                                                              &#39;resultset_attributes&#39; =&gt; &#39;HASH(0x7fdf85857a48)&#39;,</div><div>                                                              &#39;_primaries&#39; =&gt; &#39;ARRAY(0x7fdf93dcb030)&#39;,</div><div>                                                              &#39;_ordered_columns&#39; =&gt; &#39;ARRAY(0x7fdf858417e8)&#39;,</div><div>                                                              &#39;name&#39; =&gt; &#39;user_role&#39;</div><div>                                                            }, &#39;DBIx::Class::ResultSource::Table&#39; )</div><div>                                }, &#39;<b>App::DB::ResultSet</b>&#39; )</div></div><div> </div><div><br></div><div><br></div><div>And then when it is working correctly the Dump shows this:</div><div><br></div><div><div>          &#39;user_role&#39; =&gt; bless( {</div><div>                                  &#39;result_source&#39; =&gt; bless( {</div><div>                                                              &#39;source_name&#39; =&gt; &#39;UserRole&#39;,</div><div>                                                              &#39;name&#39; =&gt; &#39;user_role&#39;,</div><div>                                                              &#39;_columns_info_loaded&#39; =&gt; 0,</div><div>                                                              &#39;_primaries&#39; =&gt; &#39;ARRAY(0x4ceaea0)&#39;,</div><div>                                                              &#39;schema&#39; =&gt; &#39;App::DB=HASH(0x2c458d0)&#39;,</div><div>                                                              &#39;result_class&#39; =&gt; &#39;App::DB::Result::UserRole&#39;,</div><div>                                                              &#39;_relationships&#39; =&gt; &#39;HASH(0x783f628)&#39;,</div><div>                                                              &#39;resultset_attributes&#39; =&gt; &#39;HASH(0x7834010)&#39;,</div><div>                                                              &#39;resultset_class&#39; =&gt; &#39;App::DB::ResultSet::UserRole&#39;,</div><div>                                                              &#39;_ordered_columns&#39; =&gt; &#39;ARRAY(0x7825410)&#39;,</div><div>                                                              &#39;_columns&#39; =&gt; &#39;HASH(0x7837d20)&#39;,</div><div>                                                              &#39;_unique_constraints&#39; =&gt; &#39;HASH(0x4d17b40)&#39;</div><div>                                                            }, &#39;DBIx::Class::ResultSource::Table&#39; ),</div><div>                                  &#39;attrs&#39; =&gt; {</div><div>                                               &#39;bind&#39; =&gt; &#39;ARRAY(0x7b1ace0)&#39;,</div><div>                                               &#39;cascade_delete&#39; =&gt; 0,</div><div>                                               &#39;accessor&#39; =&gt; &#39;multi&#39;,</div><div>                                               &#39;cascade_copy&#39; =&gt; 0,</div><div>                                               &#39;is_depends_on&#39; =&gt; 0,</div><div>                                               &#39;alias&#39; =&gt; &#39;me&#39;,</div><div>                                               &#39;where&#39; =&gt; &#39;HASH(0x7b71fe0)&#39;,</div><div>                                               &#39;join_type&#39; =&gt; &#39;LEFT&#39;</div><div>                                             },</div><div>                                  &#39;pager&#39; =&gt; undef,</div><div>                                  &#39;_result_class&#39; =&gt; &#39;App::DB::Result::UserRole&#39;,</div><div>                                  &#39;cond&#39; =&gt; $VAR1-&gt;{&#39;user_role&#39;}{&#39;attrs&#39;}{&#39;where&#39;}</div><div>                                }, &#39;<b>App::DB::ResultSet::UserRole</b>&#39; )</div><div>        };</div></div></div><span class=""><font color="#888888"><div><br></div>-- <br><div>Bill Moseley<br><a href="mailto:moseley@hank.org" target="_blank">moseley@hank.org</a></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Bill Moseley<br><a href="mailto:moseley@hank.org" target="_blank">moseley@hank.org</a></div>
</div></div></div>