Justin Williams
2007-Aug-02 19:45 UTC
Overridding readonly attribute in custom form builder
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---