lib/formtastic/helpers/inputs_helper.rb in formtastic-2.0.2 vs lib/formtastic/helpers/inputs_helper.rb in formtastic-2.1.0.beta1

- old
+ new

@@ -298,11 +298,11 @@ field_set_and_list_wrapping(*((args << html_options) << contents)) end end out = template.content_tag(:li, out, :class => "input") if wrap_it - @already_in_an_inputs_block = false + @already_in_an_inputs_block = wrap_it out end protected @@ -349,11 +349,14 @@ end end # Collects content columns (non-relation columns) for the current form object class. def content_columns #:nodoc: - model_name.constantize.content_columns.collect { |c| c.name.to_sym }.compact rescue [] + # TODO: NameError is raised by Inflector.constantize. Consider checking if it exists instead. + begin klass = model_name.constantize; rescue NameError; return [] end + return [] unless klass.respond_to?(:content_columns) + klass.content_columns.collect { |c| c.name.to_sym }.compact end # Deals with :for option when it's supplied to inputs methods. Additional # options to be passed down to :for should be supplied using :for_options # key. @@ -395,6 +398,6 @@ title end end end -end \ No newline at end of file +end