In Rails 4 we use active_model_serializers gem to make JSONapi. May be Rails 5 has own tools for serialization?
So, I didn't find such built-in tool. Just two major gems: active_model_serializers
and jbuilder
. In active_model_serializers
you should write ruby classes for serializers, so there isn't specific syntax. But in jbuilder
you should use *.json.jbuilder
files for rendering json and there are "syntactic sugar" and builder-style DSL. JBuilder is my choice)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.