Questions tagged [acts-as-paranoid]

A simple plugin for Ruby on Rails that hides records instead of deleting them, enabling recovery.

acts-as-paranoid is a Rails simple plugin which hides records instead of deleting them, being able to recover them.

48 questions
10
votes
1 answer

Rails acts_as_paranoid and has_many :through

So I'm using the rails3_acts_as_paranoid gem, and having some problems controlling scope with has_many :through associations. For example # User.rb acts_as_paranoid has_many :folders has_many :files, :through => :folders - #…
7
votes
3 answers

Act as paranoid is not recovering records

I was trying to recover an object from my admin mode and it did not work Admin.only_deleted.first.recover Admin Load (1.9ms) SELECT "admins".* FROM "admins" WHERE ("admins"."deleted_at" IS NOT NULL) ORDER BY "admins"."id" ASC LIMIT…
emerak
  • 274
  • 2
  • 10
5
votes
0 answers

How to index deleted in acts_as_paranoid rows in sunspot

I'm using sunspot and acts_as_paranoid gems in ruby on rails application. When i'm deleting a record, acts_as_paranoid gem overrides ActiveRecord behaviour not no delete it, but update deleted_at field to not-null value. And by defaults, add to all…
delphist
  • 4,409
  • 1
  • 22
  • 22
5
votes
0 answers

paranoia gem restore for has one dependent destroy not working

I am using Paranoia gem(3.1.1) Rails 3.2 I've noticed that the has_one :model, dependent: :destroy is not being restored. Let's say.. class User < ActiveRecord::Base acts_as_paranoid has_many :posts, dependent: :destroy has_one :profile,…
RodM
  • 426
  • 1
  • 5
  • 19
5
votes
3 answers

friendly_id and acts_as_paranoid creating duplicate slugs

I'm current using acts_as_paranoid and friendly_id (5.0.1) on a model and when I destroy a model and try to create a new one that will generate the same slug I get: ERROR: duplicate key value violates unique constraint "index_papers_on_slug" I…
Lindsey B
  • 556
  • 3
  • 15
5
votes
1 answer

Rails acts_as_paranoid - belongs_to not working with with_deleted

I have two models with a belongs_to - has_many relationship which you can see below (I included only the parts of the code relevant to this question since the models are quite big): product.rb class Product < ActiveRecord::Base attr_accessible…
Morred
  • 51
  • 1
  • 3
4
votes
1 answer

Undelete acts_as_paranoid deleted user on devise sign in

I have a Rails 3.1.3 app which uses devise for users authentication and soft-deletes them with acts_as_paranoid. I want the accounts to be undeleted upon password recreation, user sign up and user sign in, so if they provide a deleted email, I grab…
TuteC
  • 4,342
  • 30
  • 40
4
votes
3 answers

Rails acts_as_paranoid migration issue

I have a complicated issue with Devise and the paranoia(acts_as_paranoid) gem. My User model is relatively simple: class User < AR::Base devise :confirmable, :other_config_options acts_as_paranoid end I added the Devise gem first without the…
kid_drew
  • 3,857
  • 6
  • 28
  • 38
3
votes
1 answer

How do you change how the active admin search for records

I'm working on a Rails 6 application and in the active-admin I want to show all the records, including the ones soft-deleted with paranoia. I did that adding scope :with_deleted, default: true. ActiveAdmin.register Post do actions :all, except:…
sara lance
  • 493
  • 4
  • 16
3
votes
1 answer

SystemStackError after destroying a model having ActiveStorage + act_as_paranoid - Rails 5.2

DISCLAIMER: The issue is already logged here but to bring more attention to the large community, I am posting the issue here. I have super simple setup for a model using active storage with acts_as_paranoid class FileUpload < ApplicationRecord …
Amit Patel
  • 15,609
  • 18
  • 68
  • 106
3
votes
1 answer

Act As Paranoid: really destroy record that has paranoid children

I'm using ActAsParanoid gem to soft delete some records, let's say the children. The parent is not paranoid, and I want that on destroy of the parent, the children get really destroyed. class Parent < ApplicationRecord has_many :children,…
Leticia Esperon
  • 2,499
  • 1
  • 18
  • 40
3
votes
3 answers

Update a counter cache column after restoring a record with paranoia (acts_as_paranoid)

I have a counter_cache column in my model. I use acts_as_paranoid for this model (Paranoia gem). How to update a counter cache column for an associated record when I restore a record?
2
votes
1 answer

Paranoia in recursive restore

I'm using the paranoia / acts_as_paranoid gem to soft delete my models. I have a 1 to many relationship between posts and comments. They are both paranoid and on destroy everything works as expected. My relationships are set up like…
2
votes
2 answers

Get deleted object with paranoid through related activerecord objects

I have 3 models: class Request < ActiveRecord::Base acts_as_paranoid belongs_to :offer end class Offer < ActiveRecord::Base belongs_to :cruise, inverse_of: :offers has_many :requests end class Travel < ActiveRecord::Base acts_as_paranoid…
2
votes
0 answers

Rails / Paranoia Gem: Undefined local variable or method `acts_as_paranoid'

Environment: gem "paranoia", "~> 2.0" (https://github.com/radar/paranoia); rails 4.1.8; sqlite3; When I did Listing.find(1) in rails console, it sends me such error message: undefined local variable or method `acts_as_paranoid' for Listing (call…
nathanQQ
  • 35
  • 6
1
2 3 4