I'm a fan of:
class ActionView::Helpers::InstanceTag silence_warnings do DEFAULT_FIELD_OPTIONS = {} DEFAULT_TEXT_AREA_OPTIONS = {} end end
As @gertas warned, this is a fix for internal components, so it carries a risk. Sometimes these constants moved to Rails. But overall, this is not a huge deal. Or:
- You use CSS for width and height so that all of these attributes are ignored. In this case, all you do is save a few useless characters moving around the screen. If it stops working, you just spend a few extra characters until you notice it.
- You use these attributes, so when the hack stops working, it becomes obvious (the size of the field changes), and you can quickly fix it.
Thus, it is associated with risk. But not so much, and this is the most direct way to set these defaults.
source share