restful-authenticationまたはacts_as_authenticatedとjpmobileの連携 session[:return_to]にtrans_sidが入ってないとループしちゃうので def redirect_back_or_default(default) append_trans_sid redirect_to(session[:return_to] || default) session[:return_to] = nil end def append_trans_sid return unless defined?(trans_sid_mode) && session[:return_to] if trans_sid_mode == :always || (trans_sid_mode == :mobile && request.mobile? && !request.mobile.supports_cookie?) session_key = (request.session_options[:session_key] || '_session_id') session_param = session_key + '=' + session.session_id case session[:return_to] when /#{session_param}/ return when /#{session_key}=/ session[:return_to].sub!(/#{session_key}=/, /_#{session_key}=/) end session[:return_to] << (session[:return_to].match(/[?]/).nil? ? "?" : "&") session[:return_to] << session_param end end