Forum: Ruby on Rails Two problems with Acts_as_paranoid

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
11364e09c2ea04444314e94eead06e98?d=identicon&s=25 Roland Swingler (Guest)
on 2007-01-08 14:17
(Received via mailing list)
Hi,

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
solutions).

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,

TIA,
Roland
Ae97ad0da5c7887be291561eb1720093?d=identicon&s=25 Alex Soto (asoto)
on 2007-01-10 18: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?

Alex
02c097d8b0e9d3cc7bdda10efdfec30f?d=identicon&s=25 Marcus Vorwaller (marcus)
on 2007-02-22 06: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')

Marcus
This topic is locked and can not be replied to.