# Overridding readonly attribute in custom form builder

**URL:** <https://www.ruby-forum.com/t/overridding-readonly-attribute-in-custom-form-builder/111127>\
**Category:** Rails\
**Created:** [August 2, 2007, 9:46pm UTC](https://www.ruby-forum.com/t/overridding-readonly-attribute-in-custom-form-builder/111127 "2007-08-02T21:46:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubylover](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8c91f0/32.png) [@rubylover](https://www.ruby-forum.com/u/rubylover)\
**Post date:** [August 2, 2007, 9:46pm UTC](https://www.ruby-forum.com/t/overridding-readonly-attribute-in-custom-form-builder/111127/1 "2007-08-02T21:46:15Z")

</div>

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
