nested_record:将JSON字段映射到ActiveModel对象

时间:2021-05-19 11:33:28
【文件属性】:
文件名称:nested_record:将JSON字段映射到ActiveModel对象
文件大小:34KB
文件格式:ZIP
更新时间:2021-05-19 11:33:28
Ruby NestedRecord 这个gem用于在ActiveModel对象上映射json字段! 安装 将此行添加到您的应用程序的Gemfile中: gem 'nested_record' 然后执行: $ bundle 或将其自己安装为: $ gem install nested_record 用法 使用nested_record通过JSON属性在ActiveRecord模型上定义嵌套的关联。 首先将json列添加到您的数据库中: change_table :users do | t | t . json :profile end 然后使用has_one_nested宏定义关联: class User < ActiveRecord :: Base include NestedRecord :: Macro has_one_nested :profile en
【文件预览】:
nested_record-master
----.gitignore(112B)
----README.md(6KB)
----gemfiles()
--------rails_5.2.gemfile(122B)
--------rails_6.0.gemfile(122B)
--------rails_6.1.gemfile.lock(1KB)
--------rails_6.1.gemfile(122B)
--------rails_6.0.gemfile.lock(1KB)
--------rails_5.2.gemfile.lock(1KB)
----bin()
--------console(94B)
--------setup(131B)
----.github()
--------workflows()
----Gemfile(98B)
----Appraisals(182B)
----.rspec(53B)
----Gemfile.lock(1KB)
----nested_record.gemspec(1KB)
----spec()
--------support()
--------nested_record_spec.rb(23KB)
--------nested_record()
--------spec_helper.rb(579B)
----LICENSE.txt(1KB)
----lib()
--------nested_record.rb(697B)
--------nested_record()
----Rakefile(117B)

网友评论