acts-as-paranoid

RailsAdmin custom action to restore soft deleted records

牧云@^-^@ 提交于 2019-12-11 14:01:37
问题 I am using Rails 4.1.14 with rails_admin 0.8.1, mongoid 5.0 and mongoid_paranoia. I created RailsAdmin custom action to restore soft deleted Users. class Restore ... register_instance_option :controller do Proc.new do object.restore ... end end end But I keep getting User with id '5695997df5740c17b0000002' could not be found From my develoment.log Started GET "/admin/user/5695997df5740c17b0000002/restore" for 127.0.0.1 at 2016-01-12 16:35:04 -0800 Processing by RailsAdmin::MainController

Undelete acts_as_paranoid deleted user on devise sign in

老子叫甜甜 提交于 2019-12-07 15:17:06
问题 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 that account, make it live again, and then continue with the action (password recreation, or sign in). But in the Users::SessionsController#create action, after undeletion of the user it gets an Unauthorized error (but the user should now be

Undelete acts_as_paranoid deleted user on devise sign in

拜拜、爱过 提交于 2019-12-06 01:22:23
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 that account, make it live again, and then continue with the action (password recreation, or sign in). But in the Users::SessionsController#create action, after undeletion of the user it gets an Unauthorized error (but the user should now be visible). The code is: def create # Take into account acts_as_paranoid deleted users resource = resource