<div dir="ltr"><div>I am not an expert, but shouldn&#39;t it just work with<br><br><pre><code class="">__PACKAGE__-&gt;resultset_attributes({ where =&gt; { status =&gt; { &#39;!=&#39; =&gt; &#39;deleted&#39; } } });</code></pre><br>?<br><br></div>However, I&#39;ve only ever used order_by in resultset_attributes so YMMV.<br><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 9, 2015 at 6:04 PM, Ilya Chesnokov <span dir="ltr">&lt;<a href="mailto:chesnokov.ilya@gmail.com" target="_blank">chesnokov.ilya@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I have a &quot;service&quot; table in my database and want to mark services as<br>
deleted by setting service.status = &#39;deleted&#39; instead of actually<br>
deleting them (for business reasons).<br>
<br>
I do it in a working project where DBIC is used as a database<br>
interaction layer, and it is preferable to make these changes as<br>
transparent  to the surrounding code as possible. Our codebase is<br>
(mostly) covered with tests, so it&#39;s generally easy to understand<br>
whether there is a regression or not.<br>
<br>
First I tried to override search_rs() method in a custom resultset<br>
with something like this:<br>
<a href="https://gist.github.com/ichesnokov/1d4236f79c69fd14ebbe" target="_blank">https://gist.github.com/ichesnokov/1d4236f79c69fd14ebbe</a>, but it didn&#39;t<br>
work as expected on prefetches with condition in them.<br>
<br>
Then I tried a method with resultset_attributes (see<br>
<a href="https://metacpan.org/pod/DBIx::Class::ResultSource#resultset_attributes" target="_blank">https://metacpan.org/pod/DBIx::Class::ResultSource#resultset_attributes</a>),<br>
but it didn&#39;t work because it&#39;s impossible to get<br>
&quot;current_source_alias&quot; from ResultSource.<br>
<br>
Currently I&#39;m using something based on the behavior of<br>
resultset_attributes (see<br>
<a href="https://gist.github.com/ichesnokov/e5fb7e70cb6d497ea5a0" target="_blank">https://gist.github.com/ichesnokov/e5fb7e70cb6d497ea5a0</a>), and it<br>
works, but requires fiddling with internal state of a resultset, which<br>
seems a bit wrong.<br>
<br>
Is there any better way for achieving the same?<br>
<br>
Thanks.<br>
<span class="HOEnZb"><font color="#888888">--<br>
Best regards,<br>
Ilya Chesnokov<br>
<br>
_______________________________________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
</font></span></blockquote></div><br></div>