Forum: Ruby on Rails Two problems with Acts_as_paranoid

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Roland S. (Guest)
on 2007-01-08 15:17
(Received via mailing list)

I've run into two small problems with acts_as_paranoid and wondered if
anyone else has experienced them as well (and if yes, if they have any

1. When using has_many :through, AAP doesn't seem to take into account
the fact that your join model might also be paranoid. My solution to
this at the moment is to add an explicit conditions clause to the
has_many :through statement, i.e. "join_model.deleted_at IS NULL" - is
there a better way of getting the same result?

2. My tests sometimes fail in a random fashion. Looking at the
test.log, nothing is different between test invocations, so the only
conclusion I can come to is that it has something to do with the
timestamp comparison sometimes working and sometimes not. I'm not sure
that the clock is set to 100% second accuracy on the machine I'm
working on. Has anyone else had a similar problem?

Any comments much appreciated,

Alex S. (Guest)
on 2007-01-10 19:03
(Received via mailing list)
Can you give a little more detail on the scenario?  What's a sample
find call that's causing you problems?

Marcus V. (Guest)
on 2007-02-22 07:27
(Received via mailing list)
I can verify that using has_many :through and acts_as_paranoid on the
join model deleting a join works but finding through the join ignores
the delete_at value. As Roland mentioned, this works:

indicators = user.indicators.find(:all, :conditions =>
'personal_indicators.deleted_at IS NULL')

This topic is locked and can not be replied to.