1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Tidy up previous commit

This commit is contained in:
Carlos Antonio da Silva 2010-08-14 00:19:59 -03:00
parent 03450f0007
commit 5702125175
2 changed files with 3 additions and 8 deletions

View file

@ -24,7 +24,7 @@ module SimpleForm
protected protected
def has_errors? def has_errors?
object && errors.present? object && object.respond_to?(:errors) && errors.present?
end end
def errors def errors
@ -32,11 +32,7 @@ module SimpleForm
end end
def errors_on_attribute def errors_on_attribute
if object.respond_to?(:errors)
object.errors[attribute_name] object.errors[attribute_name]
else
[]
end
end end
def errors_on_association def errors_on_association

View file

@ -29,7 +29,6 @@ class ErrorTest < ActionView::TestCase
assert_no_select 'span.error' assert_no_select 'span.error'
end end
test 'error should generate messages for attribute with single error' do test 'error should generate messages for attribute with single error' do
with_error_for @user, :name, :string with_error_for @user, :name, :string
assert_select 'span.error', "can't be blank" assert_select 'span.error', "can't be blank"