Closed
Description
I'm using this project in my application. I have classes that should return serialized objects and some that only only return the id's. At this point you can get around it by saying attributes :account_id
then specifying has_one
or has_many
. I'm proposing a change to the API that would make it easier for this situation to work. Here is my proposed change:
class UserSerializer < ActiveModel::Serializer
has_many :contacts, :embed => :objects
belongs_to :account, :embed => :id
end
The embed
method could set the preference, but I'm not sure how that would work. I am interested in adding this functionality and will gladly write a pull request if you guys thing this is a good thing to do.
Metadata
Metadata
Assignees
Labels
No labels