5261: Fix {redirect_to @object} usage.
[arvados.git] / apps / workbench / app / controllers / application_controller.rb
index b52591bc0caa5ff1b14da6ac7485a829eaeab1d8..523ef7f7815d922e7009224d65cb5b2102eb1cd3 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|