Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Did anyone use acts_as_paranoid to preserve users_roles entries? #551

Open
malayhm opened this issue Jul 26, 2020 · 2 comments
Open

Did anyone use acts_as_paranoid to preserve users_roles entries? #551

malayhm opened this issue Jul 26, 2020 · 2 comments

Comments

@malayhm
Copy link

malayhm commented Jul 26, 2020

At present, whenever remove_role is called, it removes the entries from users_roles table too.

In order to provide soft delete, one can use:
https://github.com/ActsAsParanoid/acts_as_paranoid

Did anyone use rolify with acts_as_paranoid or is it supported?

@rusucosmin
Copy link

+1

@khiav223577
Copy link

khiav223577 commented Sep 7, 2022

It is not well supported. You will have to override the association added by rolify method.

class User < ApplicationRecord
  rolify
  has_and_belongs_to_many :roles, -> { where('users_roles.deleted_at is NULL') }, join_table: :users_roles
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants