0
在我application.html.erb文件,我有:轨道4:不可与自举类显示错误消息
<div class="container">
<% flash.each do | type, message | %>
<div class="alert <%= flash_class(type) %>">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span></button>
<%= message %>
</div>
<% end %>
<%= yield %>
</div>
我有flash_class作为一个辅助方法:
module ApplicationHelper
def flash_class(type)
case type
when :alert
"alert-error"
when :notice
"alert-success"
else
""
end
end
end
虽然什么恰巧这个类没有被附加在HTML中。当我创建一个错误,“警报的错误”类不上补充说:
任何想法,为什么这可能是这样?
谢谢Vineeth,这正是我正在做的! – iamryandrake 2015-03-25 10:35:32
@iamryandrake,如果Ruby出现静态类型检查,所有这些问题都将消失。 – bsvin33t 2015-03-25 10:37:22