Ruby JSON SERIALIZER 使用场景

ciscolive · July 22, 2021 · Last by zhongsheng replied at July 22, 2021 · 469 hits

😀 最近在学习 RAILS,发现大家会用到 SERALIZERS。查看官方文档有 ActiveModel::Serialization 已实现 as_json, serailizer_hash 这些功能,也有类似的 GEM 模块,有人指点下为什么需要用到序列化的外部模块吗?

jsonapi-rb is a highly performant and modular JSON:API-only implementation. There's a vibrant community around it that has produced projects such as JSON:API Suite.
fast_jsonapi is a lightning fast JSON:API serializer for Ruby Objects.
jsonapi-resources is a popular resource-focused framework for implementing JSON:API servers.
blueprinter is a fast, declarative, and API spec agnostic serializer that uses composable views to reduce duplication. From your friends at Procore.

有时候需要把对象存在数据库,或者传递参数

You need to Sign in before reply, if you don't have an account, please Sign up first.