The solution is to do the redirect with RJS if it is Ajax request.
Though I don't plan to handle redirects in Ajax request other then to do them, I've changed ActionController::Base.redirect_to to produce RJS redirect for Ajax requests:
def redirect_to(options = {}, *params)
if request.xhr?
render :update do |page|
page.redirect_to url_for(options, *params)
end
else
super
end
end
Комментариев нет:
Отправить комментарий