diff options
author | kamille-321 <yuji.kmjm@gmail.com> | 2019-02-19 11:50:31 +0900 |
---|---|---|
committer | kamille-321 <yuji.kmjm@gmail.com> | 2019-03-11 00:51:33 +0900 |
commit | 81bc621ed01637e8305fb53c9e504b1cc46c102f (patch) | |
tree | f0404468ccf06a3df9bd8fbd6bafb55a34ecce6d /activerecord/CHANGELOG.md | |
parent | b75d6ea5d35d61c60f2675ed956c51e71d2b07ad (diff) | |
download | rails-81bc621ed01637e8305fb53c9e504b1cc46c102f.tar.gz rails-81bc621ed01637e8305fb53c9e504b1cc46c102f.tar.bz2 rails-81bc621ed01637e8305fb53c9e504b1cc46c102f.zip |
Fix query attribute method on user-defined attribute to be aware of typecasted value
change the line to check an attribute has user-defined type
ref: https://github.com/rails/rails/pull/35320#discussion_r257924552
check query attribute method is working when given value does not respond to to_i method
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index c0ef3cbe7c..a318cd3661 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,17 @@ +* Fix query attribute method on user-defined attribute to be aware of typecasted value. + + For example the following code no longer return false as casted non-empty string. + + ``` + class Post < ActiveRecord::Base + attribute :user_defined_text, :text + end + + Post.new(user_defined_text: "false").user_defined_text? # => true + ``` + + *Yuji Kamijima* + * Quote empty ranges like other empty enumerables. *Patrick Rebsch* |