Merge branch '5105-ajax-redirect' closes #5105
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index e0786418ec736aa9e3bb790dd77409c11781ca18..1b59c574b774a897372a7f771dc4cdeda5f45df2 100644 (file)
@@ -267,6 +267,17 @@ class ApplicationController < ActionController::Base
     end
   end
 
+  def redirect_to uri, *args
+    if request.xhr?
+      if not uri.is_a? String
+        uri = polymorphic_url(uri)
+      end
+      render json: {href: uri}
+    else
+      super
+    end
+  end
+
   def choose
     params[:limit] ||= 40
     respond_to do |f|