当用户在Ruby on Rails 3.2中注销时,不会显示flash [:notice]

时间:2013-09-27 07:41:47

标签: ruby ruby-on-rails-3

我正在使用Ruby on Rails 3.2.13和Ruby 1.9.3。我想在表单提交时显示flash [:notice],但问题是当用户登录然后显示完整的flash消息,但是当用户没有登录并提交此表单时,则flash消息不是所示。

在控制器/创建操作中

if @ticket
  flash[:notice] = "Thank you for contacting LittleCast. We have received your message and it has been routed to concerned department."
  redirect_to new_contact_request_path
else
  render :new
end

在application.html.erb

<% if flash[:notice].present? %>
  <div class="success-dv"><%= flash[:notice] %></div>
<% end %>

0 个答案:

没有答案