rails-api/active_model_serializers — pull request #176 by nragaz (2012-12-20 18:33:15+00:00)
Title: Use pluck(:id) or _id methods instead of associated objects

Per #140, this commit modifies association behaviour so that if you're only embedding IDs, the association serializer won't instantiate all of the associated objects just to get the ID. Instead, it will use `pluck(:id)` on collections or the `#{association_name}_id` method on the source object, with a fallback to instantiating the object if these methods aren't available.

Tests all pass and it works great in my relatively complex app. However, I'd appreciate suggestions for improvement.