diff options
author | gmarik <gmarik@users.noreply.github.com> | 2013-12-31 11:51:33 -0600 |
---|---|---|
committer | gmarik <gmarik@users.noreply.github.com> | 2013-12-31 11:51:33 -0600 |
commit | 8ea00ed91a89997098edc9d83b8ecb26ed72f8fc (patch) | |
tree | 06976b1ed9285bdf628b8ce0441176dab7cd07e9 /activerecord/lib | |
parent | c4fb191a4cc246db849f7acf31bd7edb4664cca5 (diff) | |
download | rails-8ea00ed91a89997098edc9d83b8ecb26ed72f8fc.tar.gz rails-8ea00ed91a89997098edc9d83b8ecb26ed72f8fc.tar.bz2 rails-8ea00ed91a89997098edc9d83b8ecb26ed72f8fc.zip |
Use `Array#wrap` instead `Array()`
- since `Array()` calls `to_ary` or `to_a` on a subject
- the intent is to 'wrap' subject into an array
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/validations/presence.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/validations/presence.rb b/activerecord/lib/active_record/validations/presence.rb index 6b14c39686..9a19483da3 100644 --- a/activerecord/lib/active_record/validations/presence.rb +++ b/activerecord/lib/active_record/validations/presence.rb @@ -5,7 +5,7 @@ module ActiveRecord super attributes.each do |attribute| next unless record.class.reflect_on_association(attribute) - associated_records = Array(record.send(attribute)) + associated_records = Array.wrap(record.send(attribute)) # Superclass validates presence. Ensure present records aren't about to be destroyed. if associated_records.present? && associated_records.all? { |r| r.marked_for_destruction? } |