2017-10-24 3 views
0

을 삭제 :이 지금 년 동안 어떤 문제없이 일하고있다 Override ActiveAdmin resource controller for only some resourcesActiveAdmin을 자원 제어기 재정/자원 내가 자기가-대답 다른 질문 여기에 자원 컨트롤러를 무시 해요 어떻게 설명하는 문제

,하지만 난 최근 ActiveAdmin을 업데이트 지금은 삭제할 때와 기능 명중 : 지금 받고 있어요 갑자기

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 

:

ActionController::RoutingError (No route matches [DELETE] "/admin/products"):

나는 시도했다 :

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 

이러한 작업 없음; 자원은 삭제되지만 더 이상 자원의 색인으로 재 지정되지 않습니다.

답변

0

브라우저가 delete 방법에서 리디렉션을 처리하는 방식이 변경 될 수 있습니다. 사용해보기 :

redirect_to { action: 'index', status: 303 }

+0

여전히 작동하지 않습니다. 삭제가 활성 관리자의 resource.show (세부 정보) 페이지에서 시작되었거나 색인 페이지의 작업에서 '삭제'를 누르면, 로그에있는 항목 (https : //gist.github)을 만들었습니다. co.kr/grimmwerks/bf6bd76d4fffe8a370d9aa4c25f36306 기본적으로 리디렉션하려고 시도하지만 redirect_to ({action : 'index', status : 303})를 시도해 보지 않았습니다. – grimmwerks