discourse/discourse — pull request #2270 by vikhyat (2014-04-16 15:23:38+00:00)
Title: Detect arrays for serialization using respond_to?(:to_ary)

This is the way AMS detects arrays, and is more robust than checking is_a? for whitelisted classes. For example, this works for ActiveRecord::AssociationRelation which the current logic does not handle.