【文件属性】:
文件名称:simple_json_api-rails
文件大小:48KB
文件格式:ZIP
更新时间:2021-06-12 12:49:32
Ruby
SimpleJsonApi::Rails
遵循规范呈现 json 的 。
安装
将此行添加到应用程序的 Gemfile 中:
gem 'simple_json_api-rails'
然后执行:
$ bundle
或者自己安装:
$ gem install simple_json_api-rails
用法
取决于 。
定义序列化程序
需要为每个资源创建一个序列化程序。 序列化器将定义序列化 json 的属性和关联。
class ProjectSerializer < SimpleJsonApi :: ResourceSerializer
serializes :projects , model : Project
attribute :id
attribute :name , key : :project_name
attribute :descripti
【文件预览】:
simple_json_api-rails-master
----simple_json_api-rails.gemspec(601B)
----Rakefile(584B)
----test()
--------controller_methods_test.rb(2KB)
--------test_helper.rb(1KB)
--------renderer_test.rb(2KB)
--------railtie_test.rb(409B)
--------dummy()
--------params_parser()
--------generators()
--------module_test.rb(162B)
--------integration()
--------fixtures()
----Gemfile(714B)
----Gemfile.lock(3KB)
----.gitignore(150B)
----lib()
--------simple_json_api()
--------generators()
----README.md(3KB)
----MIT-LICENSE(1KB)