json - Rails active_model_serializer applied on grouped active record -


i using active_model_serializer https://github.com/rails-api/active_model_serializers , want apply serialisation of model grouped active records.

i have model represents blogpost title, content , published date. use serializer format date more user friendly format during serialisation. works if applied on active records, firstly want group blogpost records :published , :unpublished so

posts.group_by |post|   if post.published_at.nil?     :unpublished   else     :published   end end 

if render json output of grouped data, serializer not applied on blogpost objects , data gets returned is.

does know way how apply serializer on grouped (grouped_by) active records?


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -