lib/fat_free_crm/permissions.rb
# Removes all permissions on an object
#--------------------------------------------------------------------------
Removes all permissions on an object
Removes all permissions on an object
def remove_permissions
        permissions_to_remove = if id && self.class
                                  Permission.where(asset_id: id, asset_type: self.class.name).to_a
                                else
                                  []
                                end
        permissions_to_remove.each do |p|
          permissions.delete(p)
          p.destroy
        end
      end
def remove_permissions permissions_to_remove = if id && self . class Permission . where ( asset_id : id , asset_type : self . class . name ) . to_a else [ ] end permissions_to_remove . each do | p | permissions . delete ( p ) p . destroy end end
Removes all permissions on an object
Removes all permissions on an object
# we don't use dependent => :destroy so must manually remove