I describe how I'm override the resource controller here in another question which I self-answered: Override ActiveAdmin resource controller for only some resources
This has been working without any issue for a year now, but I recently updated ActiveAdmin and now when I delete and hit the function:
def destroy
if HIPPA_CLASS_ARRAY.include? self.resource_class.name
if !params[:comment].nil? && !params[:comment].empty?
@comment=ActiveAdmin::Comment.new(namespace: "admin", author: current_admin_user, resource: resource, body: params[:comment] )
@comment.save
Utils.track_action(request, current_admin_user, "admin_#{params[:action]}", "web", params, false, resource)
resource.destroy
flash[:notice] = "Delete was successful."
#=> THE FOLLOWING IS THE PROBLEM
redirect_to { action: "index" }
else
flash[:notice] = "A delete comment can not be blank."
render :js => 'window.location.reload()'
end
else
super
end
end
Out of nowhere I'm now getting:
ActionController::RoutingError (No route matches [DELETE] "/admin/products"):
I've tried:
redirect_to { action: "index" } and return
redirect_to({ action: 'index' }, notice: "Delete was successful.", status: 302) and return
redirect_back fallback_location: { action: "index" } and return
None of these work; the resource gets deleted, but it doesn't redirect to the resource's index anymore.