开发者

Ensure 'flash' messages in controller and view files

开发者 https://www.devze.com 2023-03-21 05:57 出处:网络
I am using Ruby on Rails 3.0.9 and I would like to know if I u开发者_运维技巧se this in my controller

I am using Ruby on Rails 3.0.9 and I would like to know if I u开发者_运维技巧se this in my controller

flash[:notice] = "The <b>#{@user.name}</b> was successfully created.".html_safe

and then output that flash message in a view file is sure.


Yup that is what you do.

app/views/index.html.erb

<%= flash[:notice] %>
<%= flash[:message] %>

Or whatever the name of your flash is.

0

精彩评论

暂无评论...
验证码 换一张
取 消