Use :error_prefix instead.

This commit is contained in:
José Valim 2011-04-27 22:07:47 +02:00
parent e1e60b81c1
commit 402ee26a26
2 changed files with 2 additions and 3 deletions

View File

@ -212,13 +212,12 @@ module SimpleForm
# f.full_error :token #=> <span class="error">Token is invalid</span>
#
def full_error(attribute_name, options={})
prefix = options.delete(:prefix) || if object.class.respond_to?(:human_attribute_name)
options[:error_prefix] ||= if object.class.respond_to?(:human_attribute_name)
object.class.human_attribute_name(attribute_name.to_s)
else
attribute_name.to_s.humanize
end
options[:error_prefix] = prefix
error(attribute_name, options)
end

View File

@ -473,7 +473,7 @@ class FormBuilderTest < ActionView::TestCase
end
test 'builder should allow passing options to full error tag' do
with_full_error_for @user, :name, :id => 'name_error', :prefix => "Your name"
with_full_error_for @user, :name, :id => 'name_error', :error_prefix => "Your name"
assert_select 'span.error#name_error', "Your name can't be blank"
end