diff --git a/lib/action_view/helpers/dynamic_form.rb b/lib/action_view/helpers/dynamic_form.rb index f127ff9..70b40e2 100644 --- a/lib/action_view/helpers/dynamic_form.rb +++ b/lib/action_view/helpers/dynamic_form.rb @@ -210,13 +210,13 @@ def error_messages_for(*params) html[key] = 'error_explanation' end end - options[:object_name] ||= params.first + options[:object_name] ||= params.first.to_s.gsub('_', ' ') I18n.with_options :locale => options[:locale], :scope => [:activerecord, :errors, :template] do |locale| header_message = if options.include?(:header_message) options[:header_message] else - locale.t :header, :count => count, :model => options[:object_name].to_s.gsub('_', ' ') + locale.t :header, :count => count, :model => options[:object_name].to_s end message = options.include?(:message) ? options[:message] : locale.t(:body) diff --git a/test/dynamic_form_test.rb b/test/dynamic_form_test.rb index 378a67c..0e94e93 100644 --- a/test/dynamic_form_test.rb +++ b/test/dynamic_form_test.rb @@ -292,9 +292,6 @@ def test_error_messages_for_many_objects # any default works too assert_dom_equal %(
There were problems with the following fields:
There were problems with the following fields: