I have a delete link that makes a remote call:
<%= link_to image_tag(\"trash.png\"), [current_user, bookcase], method: :delete, :remote => true, confi
I tried the accepted answer but didn't work for me (RAILS 6), what worked for me is this :
format.js { redirect_to current_user }
Hope this help someone
Don't know if this is answering this specific question, but some might find the following helpful:
module AjaxHelper
def ajax_redirect_to(redirect_uri)
{ js: "window.location.replace('#{redirect_uri}');" }
end
end
class SomeController < ApplicationController
include AjaxHelper
def some_action
respond_to do |format|
format.js { render ajax_redirect_to(some_path) }
end
end
end
I am pretty sure this code will work.
render :js => "window.location = '/jobs/index'
You can use this code in action /controller_name/action name/
I'm pretty sure you can specify the format in the redirect_to like this
redirect_to current_user, format: 'js'