我使用引导警惕风格轨闪烁的消息,但我不知道为什么会发生显示提示信息如何防止钢轨两次
def render_flash_msgs
unless @_flash_rendered
@_flash_rendered = true
render 'shared/flash_msgs'
end
end
# return html class for flash_key
def bootstrap_class_for(flash_key)
flash_key == :notice ? 'alert-info' : "alert-#{flash_key}"
end
我不能发布图片,这样我就可以交HTML结果来源
<div id="flash">
<div class="alert" title="Notice">
<button class="close" data-dismiss="alert">×</button>
<div>Post was successfully updated.</div>
</div>
<!-- dont know why it showed again under the alert block -->
<p id="notice">Post was successfully updated.</p>
编辑:--------------------------------- ----------------- 这里是我的表格
= form_for @post do |f|
- if @post.errors.any?
#error_explanation
h2 = "#{pluralize(@post.errors.count, "error")} prohibited this post from being saved:"
ul
- @post.errors.full_messages.each do |message|
li = message
.field
= f.label :title
= f.text_field :title
.actions = f.submit 'Save'
这里是我的闪存页面-----------------------------------
#flash
- flash.each do |type, message|
.alert class=bootstrap_class_for(type)
button.close data-dismiss="alert"
| ×
div = message
你可以发布你的'.html.erb'文件中显示flash消息的部分吗? – Baldrick 2013-05-05 07:50:41
是啊,我已经发布_form和_flash偏分组 – user698855 2013-05-06 00:51:49