Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.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中的一些Desive flash消息_Ruby On Rails_Ruby_Flash_Ruby On Rails 4_Devise - Fatal编程技术网

Ruby on rails 我应该如何禁用rails中的一些Desive flash消息

Ruby on rails 我应该如何禁用rails中的一些Desive flash消息,ruby-on-rails,ruby,flash,ruby-on-rails-4,devise,Ruby On Rails,Ruby,Flash,Ruby On Rails 4,Devise,我应该如何禁用rails中的一些Desive flash消息?我已经在config/locales/designe.en.yml文件中定制了所有designe flash消息。我不想要所有的。即使在我评论或删除了其中的一些之后,我发现它们也会出现在UI中。比如说 en: devise: confirmations: confirmed: "Your account was successfully confirmed." # send_instructions

我应该如何禁用rails中的一些Desive flash消息?我已经在config/locales/designe.en.yml文件中定制了所有designe flash消息。我不想要所有的。即使在我评论或删除了其中的一些之后,我发现它们也会出现在UI中。比如说

en:
  devise:
    confirmations:
      confirmed: "Your account was successfully confirmed."
      # send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
这是我在layouts/application.html.erb中添加的

      <% if notice %>
        <p class="alert alert-notice" style="color:#c09853;"><%= notice %></p-->
      <% end %>
      <% if alert %>
        <p class="alert alert-error" style="color:#b94a48;"><%= alert %></p>
      <% end %>


我已经对send_指令进行了评论。但当我运行RestartServer时,它仍然出现在UI中。可能的解决办法是什么?谢谢。

在designe.en.yml文件中,将每条消息指定为空:

en:
  devise:
    confirmations:
      confirmed: ''
      send_instructions: '' 
      send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
在布局中:

<% flash.each do |key, value| %>
  <%= content_tag :div, value, :class => "flash #{key}" unless value.blank? %>
<% end %>

“flash{key}”除非value.blank?%>

如果将其设置为空字符串怎么办?但空条显示在顶部。添加上述内容后,该条仍会出现。检查期间的结果“”“通知”更新您的问题,使用您在布局中使用的代码显示flash messagetest notice并警告空白。仅当不为空时显示。@DAVE-感谢您的回复