Permalink
Browse files

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
  • Loading branch information...
1 parent c4fb191 commit 8ea00ed91a89997098edc9d83b8ecb26ed72f8fc @gmarik gmarik committed Dec 31, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/validations/presence.rb
@@ -5,7 +5,7 @@ def validate(record)
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? }

0 comments on commit 8ea00ed

Please sign in to comment.