OHhHHHHHHH.. Lemme have a think..

I think we need to define deactivating a user vs deleting a user


On Fri, Mar 21, 2014 at 10:16 AM, James Kiesel <notifications@github.com>wrote:

> In app/admin/users.rb:
>
> > @@ -37,6 +37,17 @@
> >      user.save
> >      redirect_to admin_users_url, :notice => "User updated"
> >    end
> > +
> > +  member_action :destroy, :method => :post do
> > +    user = User.find(params[:id])
> > +    relations = User.reflect_on_all_associations(:has_many)
> > +                    .select { |d| d.options[:dependent] != :destroy }
> > +                    .collect(&:name)
> > +    relations.each { |relation| user.send(relation).destroy_all }
>
> Ah, that's to clear up relations that aren't dependent: destroy, since we
> want to basically salt the earth on that particular user.
>
> If I remember right, [I'll check again] things like discussions and
> comments aren't dependent: destroy, so they'd get left behind when we
> called this.
>
> Is there a better way? Or do we think it's ok to leave those objects as
> orphans once the user's gone?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/loomio/loomio/pull/1390/files#r10816799>
> .
>