ruby on rails 4 - ActiveModel::Serializer define attribute attributes? -


i'm trying implement json api rails app. requires attributes field defined. activemodel::serializer has method same name, hence

class fooserializer < activemodel::serializer   attributes :attributes    def attributes     {       # filled     }   end end 

will override original method. ever possible add attributes field somehow?

activemodel serializer has support json api out of box. need setup proper adapter.

activemodelserializers.config.adapter = :json_api 

https://github.com/rails-api/active_model_serializers/blob/master/docs/general/adapters.md


Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -