I have a list of Accounts that get called throught the paranoid gem this in the accounts_controller: @deleted_accounts_count = Account.only_deleted.count
, or
@deleted_accounts = Account.only_deleted.paginate(
total_entries: @deleted_accounts_count,
page: params[:page],
per_page: 10
)
Anyhow. I can call this list through the console fine in the console, but I'm trying to call a specific Account and hard-delete (really_destroy
) it - every time I try to call it using its name, id (327) or its deleted_at attribute I get an empty object.
Account.only_deleted.where(deleted_at:"2018-07-25 07:39:57")
[■] Account Load (1.7ms) SELECT "accounts".* FROM "accounts" WHERE ("accounts"."deleted_at" IS NOT NULL) AND "accounts"."deleted_at" = $1 [["deleted_at", "2018-07-25 07
:39:57"]]
=> #<ActiveRecord::Relation []>
irb(main):008:0> Account.only_deleted.where(id:327)
[■] Account Load (1.0ms) SELECT "accounts".* FROM "accounts" WHERE ("accounts"."deleted_at" IS NOT NULL) AND "accounts"."id" = $1 [["id", 327]]
=> #<ActiveRecord::Relation []>
irb(main):009:0> Account.only_deleted.find(id:327)
[■] Account Load (1.1ms) SELECT "accounts".* FROM "accounts" WHERE ("accounts"."deleted_at" IS NOT NULL) AND "id"."id" = 327 LIMIT 1
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: missing FROM-clause entry for table "id"
LINE 1: ..." WHERE ("accounts"."deleted_at" IS NOT NULL) AND "id"."id" ...
^
: SELECT "accounts".* FROM "accounts" WHERE ("accounts"."deleted_at" IS NOT NULL) AND "id"."id" = 327 LIMIT 1
How do I call this deleted account from the soft-deleted list in order to apply the method I need?