我有以下模型结构:a Banner embeds_many Slides和eachSlide embeds_many contents
class Banner
include Mongoid::Document
embeds_many :slides
accepts_nested_attributes_for :slides, allow_destroy: true
end
class Slide
include Mongoid::Document
embedded_in :banner
embeds_many :contents
accepts_nested_attributes_for :contents, allow_destroy: true
end
class Content
include Mongoid::Document
embedded_in :slide
field :value, type: String
end
Run Code Online (Sandbox Code Playgroud)
我开始使用一张带有一些内容的幻灯片的横幅.现在我向服务器发送一个JSON请求,将新内容添加到现有幻灯片中,并创建包含其内容的新幻灯片; 就像是
'banner' => {
'_id' => '123',
'slides_attributes' => [
{
'_id' => '1',
'contents_attributes' => [
{ '_id' => '1', 'value' => 'some persisted value' },
{ 'value' => 'new content here, there is no …Run Code Online (Sandbox Code Playgroud) single-table-inheritance nested-attributes mongoid4 ruby-on-rails-4.1
在亚马逊MWS API中,请求报告类型为"_GET_MERCHANT_LISTINGS_DATA_"时 返回的属性有什么区别: