josevalim/active_model_serializers — Issue #7: has_many associations blow up if the collection is nil
Author: Adman65
Created: 2011-12-06 13:44:39+00:00
State: open

Title says it all. You get an `UndefinedMethodError, map for NilClass` when it's serialized. How should this be handled?

This is only a problem no ActiveRecord associations since they return `[]` if empty. The library should be robust enough to handle this case. I think that just putting `"comments": []` would be ok in the vast majority of situations.