diff options
author | Yuki Nishijima <mail@yukinishijima.net> | 2014-10-15 17:32:35 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-10-20 08:45:37 +0200 |
commit | df08a45a77da755409f344de6be5e2af38296310 (patch) | |
tree | 6a2df2cf616bc1d08fa9313154a48a5d975cd6b7 /activerecord/test/cases | |
parent | b6ec6a2273c6eb128025803cd9cec758174c36eb (diff) | |
download | rails-df08a45a77da755409f344de6be5e2af38296310.tar.gz rails-df08a45a77da755409f344de6be5e2af38296310.tar.bz2 rails-df08a45a77da755409f344de6be5e2af38296310.zip |
AR::UnknownAttributeError should include the class name of a record
This would be helpful if 2 models have an attribute that has a similar
name to the other. e.g:
before:
User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"])
# => ActiveRecord::UnknownAttributeError: unknown attribute: name
after:
User.new(name: "Yuki Nishijima", projects_attributes: [name: "kaminari"])
# => ActiveRecord::UnknownAttributeError: unknown attribute on User: name
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/attribute_methods_test.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 7ca7349528..3fdb70a137 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -736,11 +736,11 @@ class AttributeMethodsTest < ActiveRecord::TestCase def test_bulk_update_raise_unknown_attribute_error error = assert_raises(ActiveRecord::UnknownAttributeError) { - @target.new(:hello => "world") + Topic.new(:hello => "world") } - assert_instance_of @target, error.record + assert_instance_of Topic, error.record assert_equal "hello", error.attribute - assert_equal "unknown attribute: hello", error.message + assert_equal "unknown attribute on Topic: hello", error.message end def test_methods_override_in_multi_level_subclass |