AMS Not working

99 views
Skip to first unread message

Carlos Aguilar

unread,
Aug 26, 2014, 3:17:32 AM8/26/14
to rails-a...@googlegroups.com
Hello all,

I am trying to integrate Active Model Serializer to render json elements with relations.

I follow the documentation on this address: http://rubydoc.info/gems/active_model_serializers

I am not sure if I am doing something wrong, but looks like serializers are not working. I need make more steps?

I install the gem, generate the serializer and add relation.

Can you guide me please??

My project is in this repo:


Best Regards

Tema Bolshakov

unread,
Aug 26, 2014, 3:26:07 AM8/26/14
to Carlos Aguilar, rails-a...@googlegroups.com
You should define serializer this way 

class TravelerSerializer
  attributes :id # this tells serializer to render id attribute from serializer object

  belongs_to :travel # This tells to render travel with TravelSerializer. Your traveler object should respond to method #travel
end


26 авг. 2014 г., в 11:17, Carlos Aguilar <darka...@gmail.com> написал(а):

--
You received this message because you are subscribed to the Google Groups "rails-api-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rails-api-cor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve Klabnik

unread,
Aug 26, 2014, 11:42:57 AM8/26/14
to Tema Bolshakov, Carlos Aguilar, rails-a...@googlegroups.com
This mailing list is to discuss actual developments around rails-api,
not for help. Please ask AMS questions on StackOverflow:
https://stackoverflow.com/questions/tagged/active-model-serializers
Reply all
Reply to author
Forward
0 new messages