Ruby on rails Rails 4中的Html安全Flash哈希?
我想在我的flash哈希中添加一个链接 我的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.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>"