Convert collection to array if it's an ActiveRecord::Relation