我正在尝试将此类数据存储在 Elasticsearch 索引中
{
"id": "5644596f9bf67301645999d9",
"headline": "Scientists Look Beyond Solar System to Study Planet",
"renditions": {
"baseImage": {
"height": 933,
"href": "www.imgur.com/animage",
"mimetype": "image/jpeg",
"width": 1400
},
"preview": {
"height": 500,
"href": "www.imgur.com/animage",
"mimetype": "image/jpeg",
"width": 400
},
"thumbnail": {
"height": 150,
"href": "www.imgur.com/animage",
"mimetype": "image/jpeg",
"width": 125
}
}
}
Run Code Online (Sandbox Code Playgroud)
然而,映射不断为“再现”的所有不同子代添加独特的块。
理想情况下,我会为“再现”定义一种子类型,然后断言其下的所有对象都应该是这样的。
这可能吗?
我研究过动态映射,但我对它有点困惑......
经过大量的搜索和阅读后,我得到了一个看起来像这样的collection_select
<%= collection_select :selection, :level, User::LEVELS, :to_s, :to_s,{:with => "this.value"},
{:onchange => remote_function(
:url => {:action => "updatelevel", :controller => "user", :id=> user.id})
} %>
Run Code Online (Sandbox Code Playgroud)
然而它没有将所选值传递给我的控制器,我唯一得到的就是零.
我已经搞砸了其中的不同组合:应该和尝试测试字符串但它似乎永远不会做任何事情.
我错过了一些愚蠢的东西吗?我应该看一下"具有挑战性"的例子吗?
Rails似乎变化如此之快以至于很难知道论坛帖子正在讨论哪个版本,而我为collection_select读取的api并没有显示我可以在options hash中添加的内容.