lib/mack/view_helpers/form_helpers.rb in mack-0.8.0.101 vs lib/mack/view_helpers/form_helpers.rb in mack-0.8.1

- old
+ new

@@ -286,11 +286,20 @@ unless fe.calling_method == :to_s options.merge!(:name => "#{name}[#{fe.calling_method}]", :id => "#{name}_#{fe.calling_method}") end options[:value] = var.send(fe.calling_method) + if var.has_errors?(fe.calling_method) + fe.options = {:error_class => "error"}.merge(fe.options) + class_arr = fe.options[:class].to_s.split(" ").collect { |s| s.strip } + class_arr << fe.options[:error_class] + fe.options[:class] = class_arr.join(" ") + end + yield var, fe, options if block_given? + # we don't need the error_class by this time, since if used it will get appended into options[:class] + fe.options.delete(:error_class) return label_parameter_tag(name, options[:id], var, fe) + non_content_tag(:input, options.merge(fe.options)) end end class FormElement # :nodoc: \ No newline at end of file