0

我是这门语言的新手,如果这浪费了你的时间,请原谅我。用户完成提交查询后,下面的代码应显示“消息已成功发送” 。它没有按预期工作。谢谢

flash.now.notice= "Message was successfully sent."
4

1 回答 1

2

flash是一个哈希,试试flash[:notice] = "mesage".

然后:

# on whichever template you want to render the flash messages, 
# most likely on layouts/application.html.erb
<% if flash[:notice] %>
  <div class="notice"><%= flash[:notice] %></div>
<% end %>
于 2012-11-20T23:50:32.480 回答