I’m using act_as_paranoid plugin for most of my models. One of the
reasons was that I didn’t want to break references between objects
after I “deleted” an object. One of the cases was to know which user
modified something even after I deleted the user.
My problem now is that I cannot access the user after it was deleted
if I use the :has_and_belongs_to :user relationship.
Is there any way to override act_as_paranoid behavior only to access
relationships in some cases even if the object is soft deleted?
Santiago E. wrote:
I’m using act_as_paranoid plugin for most of my models. One of the
reasons was that I didn’t want to break references between objects
after I “deleted” an object. One of the cases was to know which user
modified something even after I deleted the user.
My problem now is that I cannot access the user after it was deleted
if I use the :has_and_belongs_to :user relationship.
Is there any way to override act_as_paranoid behavior only to access
relationships in some cases even if the object is soft deleted?
user.things.find(:all, :with_deleted => true)
Jonathan
On 3/29/06, Jonathan W. [email protected] wrote:
relationships in some cases even if the object is soft deleted?
user.things.find(:all, :with_deleted => true)
That isn’t required any more. Try this:
user.things.find_with_deleted(:all)
–
Rick O.
http://techno-weenie.net
On 3/29/06, Rick O. [email protected] wrote:
Is there any way to override act_as_paranoid behavior only to access
relationships in some cases even if the object is soft deleted?
user.things.find(:all, :with_deleted => true)
That isn’t required any more. Try this:
user.things.find_with_deleted(:all)
That’s fine as you are going from User to Things. What if you go the
other way?
What I mean is … I delete a user whose model has act_as_paranoid.
“Things” doesn’t get deleted, on purpose, if you delete a user because
the relationship is only to know who created that “thing”. I have an
object type Thing that I want to show in a page and I want to find out
who created it, but the user was soft deleted.
How can I do that?
Santiago