提交 a1ad02a4 编写于 作者: P Philip Arndt

Made ArgumentError messages consistent.

上级 83302a4c
......@@ -351,7 +351,7 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib
if respond_to?(method)
send(method, attributes.except(*unassignable_keys(assignment_opts)), assignment_opts)
else
raise ArgumentError, "Cannot build association #{association_name}. Are you trying to build a polymorphic one-to-one association?"
raise ArgumentError, "Cannot build association `#{association_name}'. Are you trying to build a polymorphic one-to-one association?"
end
end
end
......@@ -373,7 +373,7 @@ def assign_nested_attributes_for_one_to_one_association(association_name, attrib
# })
#
# Will update the name of the Person with ID 1, build a new associated
# person with the name `John', and mark the associated Person with ID 2
# person with the name 'John', and mark the associated Person with ID 2
# for destruction.
#
# Also accepts an Array of attribute hashes:
......
......@@ -196,7 +196,7 @@ def setup
end
def test_should_raise_argument_error_if_trying_to_build_polymorphic_belongs_to
assert_raise_with_message ArgumentError, "Cannot build association looter. Are you trying to build a polymorphic one-to-one association?" do
assert_raise_with_message ArgumentError, "Cannot build association `looter'. Are you trying to build a polymorphic one-to-one association?" do
Treasure.new(:name => 'pearl', :looter_attributes => {:catchphrase => "Arrr"})
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册