Displaying 1 result from an estimated 1 matches for "has_one_paranoid".
2008 Feb 12
0
acts_as_paranoid: has_one_paranoid
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
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(:d...