Destroy user_attributes and attribute_values when a user is destroyed
This commit is contained in:
1 parent
83bbd77d96
commit
43d87ecf98
3 files changed
+7
-2
No files matched your search
@@ -65,6 +65,10 @@ class Panel::UsersController < ApplicationController
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
@user.destroy
|
||||
@user.user_attributes.each do |ua|
|
||||
ua.attribute_values.each(&:destroy)
|
||||
ua.destroy
|
||||
end
|
||||
end
|
||||
|
||||
redirect_to :action => :index
|
||||
|
||||
@@ -10,6 +10,7 @@ class User
|
||||
field :admin, :type => Boolean, :default => true
|
||||
field :active_roles, :type => Array
|
||||
|
||||
has_many :user_attributes
|
||||
has_many :user_roles
|
||||
has_many :user_infos
|
||||
before_save :clean_active_roles
|
||||
|
||||
Reference in new issue
Block a user