# Acts\_as\_paranoid: has\_one\_paranoid

**URL:** <https://www.ruby-forum.com/t/acts-as-paranoid-has-one-paranoid/128841>\
**Category:** Rails\
**Created:** [February 12, 2008, 2:09am UTC](https://www.ruby-forum.com/t/acts-as-paranoid-has-one-paranoid/128841 "2008-02-12T02:09:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISESSmith-Heister](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ea666f/32.png) [@ISESSmith-Heister](https://www.ruby-forum.com/u/ISESSmith-Heister)\
**Post date:** [February 12, 2008, 2:09am UTC](https://www.ruby-forum.com/t/acts-as-paranoid-has-one-paranoid/128841/1 "2008-02-12T02:09:16Z")

</div>

Hi all,

Ran in to a problem with AR::B#find(:include) and acts\_as\_paranoid,  
well described here:

[http://www.ruby-forum.com/topic/57945](http://www.ruby-forum.com/topic/57945)

So I whipped up this thing, which seems to work for me:

module ActiveRecord  
class Base  
def self.has\_one\_paranoid(\*args)  
ref = create\_has\_one\_reflection \*args  
cond = args.last[:conditions]  
cond = cond.blank? ? ‘’ : cond + ’ AND’  
cond \<\< " (#{ref.table\_name}.deleted\_at IS NULL OR  
#{ref.table\_name}.deleted\_at \> ‘#{Time.now.to\_s(:db)}’)"  
args.last[:conditions] = cond  
has\_one \*args  
end  
end  
end

I have two questions about it: 1) where’s a good place to post it to  
get it into trunk, rubyforge’s tracker didn’t seem too lively. 2) are  
there any spots where I should be doing it differently? I’m not  
familiar with AR’s best practices.
