Sha256: 717e2e5fa69f809c641ba11599828e8dee54fb619a0b527528d84b9be05e4346
Contents?: true
Size: 597 Bytes
Versions: 3
Compression:
Stored size: 597 Bytes
Contents
module Spree module Admin class CleanDataController < BaseController def destroy_data params[:resources].each_key do |resource| case resource when "user" Spree::User.where('id NOT IN (SELECT user_id FROM spree_roles_users)').delete_all when "address" Spree::Address.delete_all else "Spree::#{resource.classify}".constantize.delete_all end end flash[:notice] = "Selected data has been successfully deleted" redirect_to admin_clean_data_path end end end end
Version data entries
3 entries across 3 versions & 1 rubygems