如何在未通过验证时停止Rails更改我的代码.
每次铁路包裹我的田地
- <div class='field_with_error'>...</div>
我可以编辑fields_with_error类
- .fields_with_error{ display: inline }
这是有效的,但它是hacky
解决方法
没关系.使用CSS而不是这样做.
- ActionView::Base.field_error_proc = Proc.new do |html_tag,instance_tag|
- "<span class='field_error'>#{html_tag}</span>"
- end
我觉得哪个更hacky