I want to delete some "Accounts’ that have dependent “Users”, however I
want to skip users tagged is_power. I want to do this by resetting the
users to a master account id.
In my User model I have the following code:
before_destroy :reset_power_users
def reset_power_users
users = User.find_by_account_id_and_is_power(account.id, true)
users.each {|user| update_attribute(:account_id, 1)}
end
I’m not sure the variables I’m passing are correct, but it’s not
throwing and error and deleting all users under the current account.
Thanks in advance for taking a look