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/lib/active_record | |
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/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/errors.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 52c70977ef..2b9b3c8f73 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -167,7 +167,7 @@ module ActiveRecord def initialize(record, attribute) @record = record @attribute = attribute.to_s - super("unknown attribute: #{attribute}") + super("unknown attribute on #{@record.class}: #{attribute}") end end |