Two problems with Acts_as_paranoid


#1

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


#2

Can you give a little more detail on the scenario? What’s a sample
find call that’s causing you problems?

Alex


#3

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