Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 重定向到不同子域后,rails 3闪存未清除_Ruby On Rails_Session_Subdomain_Cookiestore - Fatal编程技术网

Ruby on rails 重定向到不同子域后,rails 3闪存未清除

Ruby on rails 重定向到不同子域后,rails 3闪存未清除,ruby-on-rails,session,subdomain,cookiestore,Ruby On Rails,Session,Subdomain,Cookiestore,我有一个这样的控制器 class SomethingController < ApplicationController def show flash[:notice] = "TEST" redirect_to root_path(:subdomain => 'test') end end 我的问题如下。如果我转到(导致上述控制器操作的路由),该操作将正确设置闪存并重定向到相应的子域url(http://test.example.com/). 该动作的视图正

我有一个这样的控制器

class SomethingController < ApplicationController
  def show
    flash[:notice] = "TEST"
    redirect_to root_path(:subdomain => 'test')
  end
end
我的问题如下。如果我转到(导致上述控制器操作的路由),该操作将正确设置闪存并重定向到相应的子域url(http://test.example.com/). 该动作的视图正确显示我在上一动作中设置的闪光灯。但是,在执行此操作后,或者在相关子域上执行任何后续操作后,闪存都不会被清除,并且会继续显示,直到我手动导航回根域(example.com)上的其他URL,此时闪存会被重置,并且不再显示在任何一个域上

如果我尝试使用

flash.now[:notice] = "TEST"
而不是

flash[:notice] = "TEST"
重定向末尾的页面根本不注册消息的存在,因此不显示任何内容

我如何获得上面第一种情况中描述的功能,但它的行为与正常情况相同,并在请求后清除闪存

flash[:notice] = "TEST"