Custom form builders

Hey all

Just a quick one about custom form builders…

I currently have:

class TaggedBuilder < ActionView::Helpers::FormBuilder

#Creates HTML for views

def self.create_tagged_field(method_name)
define_method(method_name) do |label, *args|
@template.content_tag(“div”,
# div content
@template.content_tag(“div”,
“\n” + @template.content_tag(‘label’,
label.to_s.humanize,
:for =>
“#{@object_name}_#{label}”),
:class => ‘column general’) +
“\n” + @template.content_tag(“div”, super, :class => ‘column
general’),
:class => ‘table-row auto-height left-align’)

end

end

field_helpers.each do |name|
create_tagged_field(name)
end

end

But i want to add in what is effectivly error_messages_on(:object,
:method), but ive no idea what the syntacx should be to put it in in
this context? as if i try that - not expecting it to work - it errors!

undefined method `error_messages_on’ for #TaggedBuilder:0x27886f0

Any help would be great

Cheers

Tim

Hi Tim,

Sorry to mail you personally, but I’ve run into the exact same problem
with displaying errors using a custom FormBuilder and I can’t find
anything. Did you ever figure out how to do it?

Thanks for any help,
Isaac

On Oct 29, 1:21 pm, Tim P. [email protected]