diff options
author | Ernie Miller <ernie@erniemiller.org> | 2012-09-06 15:39:42 -0400 |
---|---|---|
committer | Ernie Miller <ernie@erniemiller.org> | 2012-09-08 17:40:01 -0400 |
commit | 4f107da4ffafa2b77d87fc5a6fb09fa34343184c (patch) | |
tree | 6b883121105d798ee671d10fb5199971841e5223 /activerecord/CHANGELOG.md | |
parent | f6296601a2fcd440cc12bbc5e0b6c61ce7269ecb (diff) | |
download | rails-4f107da4ffafa2b77d87fc5a6fb09fa34343184c.tar.gz rails-4f107da4ffafa2b77d87fc5a6fb09fa34343184c.tar.bz2 rails-4f107da4ffafa2b77d87fc5a6fb09fa34343184c.zip |
Raise MissingAttributeError on query methods
When calling a query method on an attribute that was not selected by
an ActiveRecord query, an ActiveModel::MissingAttributeError is not
raised. Instead, a nil value is returned, which will return false once
cast to boolean.
This is undesirable, as we should not give the impression that we know
the attribute's boolean value when we haven't loaded the attribute's
(possibly) non-boolean value from the database.
This issue is present on versions going back as far as 2.3, at least.
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index b4a04e32d7..6f7b2cb108 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,11 @@ ## Rails 4.0.0 (unreleased) ## +* Attribute predicate methods, such as `article.title?`, will now raise + `ActiveModel::MissingAttributeError` if the attribute being queried for + truthiness was not read from the database, instead of just returning false. + + *Ernie Miller* + * `ActiveRecord::SchemaDumper` uses Ruby 1.9 style hash, which means that the schema.rb file will be generated using this new syntax from now on. |