Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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 4中的Html安全Flash哈希?_Ruby On Rails_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails Rails 4中的Html安全Flash哈希?

Ruby on rails Rails 4中的Html安全Flash哈希?,ruby-on-rails,ruby-on-rails-4,Ruby On Rails,Ruby On Rails 4,我想在我的flash哈希中添加一个链接 我的flash哈希设置如下: flash.now[:notice] = "<a href='http://google.com'>foo</a>".html_safe 但是,要取消scape,您需要使用“等字符 = raw notice 更新 除上述内容外,请尝试 flash.now[:notice] = "<a href='http://google.com'>foo</a>" flash.now[

我想在我的flash哈希中添加一个链接

我的flash哈希设置如下:

flash.now[:notice] = "<a href='http://google.com'>foo</a>".html_safe
但是,要取消scape,您需要使用“等字符

= raw notice

更新

除上述内容外,请尝试

flash.now[:notice] = "<a href='http://google.com'>foo</a>"
flash.now[:注意]=“”

谢谢你的回答。我刚刚尝试了这个,但它对我不起作用。我也尝试了=raw notice.html\u safe,但也不起作用。我修改了帖子。请尝试一下。尝试从flash声明中删除
html\u safe
,并在视图中保持
html\u安全
flash.now[:notice] = "<a href='http://google.com'>foo</a>"