Closed
Description
I'm using the 0.10.0.rc1 version because 0.9.x doesn't work, but with this definition of the serializer:
class Api::V1::ItinerarySerializer < ActiveModel::Serializer
attributes :id, :title
embed :ids, include: true
has_many :pois, serializer: Api::V1::PoiSerializer
end
I get this error:
NoMethodError (undefined method `embed' for Api::V1::ItinerarySerializer:Class):
app/serializers/api/v1/itinerary_serializer.rb:4:in `<class:ItinerarySerializer>'
app/serializers/api/v1/itinerary_serializer.rb:1:in `<top (required)>'
app/controllers/api/v1/itineraries_controller.rb:29:in `update'
Embed is deprecated? How can I generate the "old" JSON including associated objects, like this:
{
"itinerary": {
"poi_ids": [1,4,5]
},
{ "pois": [
// POI serialized objects
]}
}