The form helpers by default wrap fields with errors in a div with an appropriate class. Unfortunately this means that you can't place these in <p> tags which many do (including for example the rails scaffold). It is a simple change to generate spans instead of divs (or generally make any sort of change that seems appropriate).
This may break the appearance of your app, whether it's because of style rules attached to div.fieldWithErrors that will no longer apply or because the styles that previously applied to broken html look different on correct html. Unfortunately this is the sort of breakage that is hard to verify automatically. So it seems there are three ways forward (not counting the 'do nothing' way:
- change the default settings to generate spans. It's not hard for you to change it back to divs in an initializer or something if you need it the old way - leave the current defaults but have a span based markup in the rails3_new_defaults initializer so that new apps will get 'good' behaviour - the current code sucks and it would be much nicer to have this sort of stuff controller by the form builder rather than some setting on ActionView::Base (and once you've done that rewrite then you still have to decide what actual markup is generated by default)
Opinions appreciated (assuming you're not drunk on christmas cheer)
Ticket is here #1626 fieldWithErrors shouldn't use a div - Ruby on Rails - rails