request.request_uri
실제로 AJAX URI에 대한 것입니다. 내가 찾은 유일한 해결책은 AJAX 요청 (또는 적어도 로그인 페이지로 리디렉션 될 수있는 요청)을 만드는 것입니다. 예를 들어 전체 페이지의 URI가 포함됩니다.
form_remote_for ... do |f|
hidden_field_tag :this_page, request.request_uri
# only works if this view itself is not loaded over AJAX!
또는 더 보편적 인 접근
:
form_remote_for :html => {:onsubmit => '$("this_page").value = window.location'}, ... do |f|
hidden_field_tag :this_page, request.request_uri
# non-JS clients just end up with the value given here
는
# in the login action
session[:return_to] = params[:this_page]
작동하지 않았다 이러한 중 하나를 결합! 그것은 실제로 사용자를 로그인 페이지에 유지 시켰습니다. – Tam