我在accounts_controller中有一个通过偏执狂而被称为的帐户列表:@deleted_accounts_count = Account.only_deleted.count
或
@deleted_accounts = Account.only_deleted.paginate(
total_entries: @deleted_accounts_count,
page: params[:page],
per_page: 10
)
反正。我可以在控制台中通过控制台很好地调用此列表,但是我尝试调用一个特定的帐户并对其进行硬删除(really_destroy
)-每次尝试使用其名称id(327)对其进行调用时)或其delete_at属性,我得到一个空对象。
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
如何应用软删除列表中的这个已删除帐户,以应用所需的方法?