Make TabularFormBuilder behave with subforms #586

This commit is contained in:
Felix Schäfer 2011-08-18 12:43:38 +02:00 committed by Felix Schäfer
parent ec4b42f24f
commit 2753973ffe
1 changed files with 2 additions and 3 deletions

View File

@ -40,8 +40,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
text = options[:label].is_a?(Symbol) ? l(options[:label]) : options[:label]
text ||= l(("field_" + field.to_s.gsub(/\_id$/, "")).to_sym)
text += @template.content_tag("span", " *", :class => "required") if options.delete(:required)
@template.content_tag("label", text,
:class => (@object && @object.errors[field] ? "error" : nil),
:for => (@object_name.to_s + "_" + field.to_s))
@template.label(@object_name, field.to_s, text,
:class => (@object && @object.errors[field] ? "error" : nil))
end
end