fixes 2246 - deleting an environment also deletes associated templates

see http://projects.theforeman.org/issues/2246