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
This commit is contained in:
gmarik 2013-12-31 11:51:33 -06:00
parent c4fb191a4c
commit 8ea00ed91a

@ -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? }