Overridding readonly attribute in custom form builder


#1

Hi,

I’ve created a custom form builder and overridden text_area so that
all fields are readonly.

There are a few instances that I would want an editable text_area, so
I have tried to create an editable_text_area method.

I have tried passing text_area(method,
options.merge(:readonly=>false)) to the method, but it doesn’t work:
the area is still not editable. Any suggestions on how to override
the readonly value in my editable method?

class ReadOnlyFormBuilder < ActionView::Helpers::FormBuilder
def text_area(method, options = {})
super(method, options.merge(:readonly=>true))
end

def editable_text_area(method, options = {})
text_area(method, options.merge(:readonly=>false))
end
end