<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div><div style="font-family: Calibri,sans-serif; font-size: 11pt;">OK, solved my problem by creating a separate view in my database that only includes services with proper statuses. The "solution" I tried to use first didn't work properly as well, don't try to use it (without modification, at least)!</div></div><div dir="ltr"><hr><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">От: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:chesnokov.ilya@gmail.com">Ilya Chesnokov</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Отправлено: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">‎09.‎03.‎2015 21:04</span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Кому: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;"><a href="mailto:dbix-class@lists.scsys.co.uk">dbix-class@lists.scsys.co.uk</a></span><br><span style="font-family: Calibri,sans-serif; font-size: 11pt; font-weight: bold;">Тема: </span><span style="font-family: Calibri,sans-serif; font-size: 11pt;">"Deletion" of records by setting status to 'deleted'</span><br><br></div>Hi,<br><br>I have a "service" table in my database and want to mark services as<br>deleted by setting service.status = 'deleted' 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&nbsp; to the surrounding code as possible. Our codebase is<br>(mostly) covered with tests, so it'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>https://gist.github.com/ichesnokov/1d4236f79c69fd14ebbe, but it didn't<br>work as expected on prefetches with condition in them.<br><br>Then I tried a method with resultset_attributes (see<br>https://metacpan.org/pod/DBIx::Class::ResultSource#resultset_attributes),<br>but it didn't work because it's impossible to get<br>"current_source_alias" from ResultSource.<br><br>Currently I'm using something based on the behavior of<br>resultset_attributes (see<br>https://gist.github.com/ichesnokov/e5fb7e70cb6d497ea5a0), 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>-- <br>Best regards,<br>Ilya Chesnokov<br></body></html>