我正在使用shopify_api宝石。
API文档显示,您可以ShopifyAPI::Order通过告诉响应返回哪些字段来缩小响应。例如,以下内容将仅返回该id属性,以及该shipping_address属性
ShopifyAPI::Order.find(:all, params: {fields: "id,shipping_address"})
shipping_address碰巧是其中包含多个字段的哈希。是否可以指定嵌套在其中的字段shipping_address返回?例如
ShopifyAPI::Order.find(:all, params: {fields: "id,shipping_address['country_code']"})
这可能会返回类似
#<ShopifyAPI::Order:0x0000010558b348
@attributes={
"id"=>12345678,
"shipping_address"=>#<ShopifyAPI::ShippingAddress:0x0000010558aa88
@attributes={"country_code"=>"US"},
@prefix_options={},
@persisted=false>
},
@prefix_options={},
@persisted=true>
Run Code Online (Sandbox Code Playgroud)
我知道我可以选择自己的属性(order.shipping_address.country_code),但这更多是为了“缩小”响应。
奖励问题1:使用fields参数有什么明显的好处?
奖励问题2: Shopify何时(如果有)会返回零送货地址?
我试图给一个'卡'元素一个阴影,它看起来像是从页面上抬起来的.我正在使用:: after伪元素,css变换和盒子阴影.
我使用的是Mac OSX,Chrome(最新版本)和Firefox 5.结果是

如您所见,firefox渲染中有一个奇怪的类似边框的工件.这种颜色似乎与身体背景颜色有关 - 正如你在第二个firefox示例中看到的那样.
为此,我有以下代码:
HTML:
<div class="card_container">
<div class="card">
<!-- Content //-->
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.card{
padding: 5px;
background-color: #fff;
border: 1px solid #aaa;
height: 375px;
margin-bottom: 20px;
}
.card_container::after{
content: "";
width: 210px;
height: 10px;
-webkit-transform: rotate(2deg);
-moz-transform: rotate(2deg);
box-shadow: 3px 3px 3px #4a4a4a;
background-color: #4a4a4a;
position:absolute;
bottom: 20px;
right: 8px;
z-index: -1;
}
Run Code Online (Sandbox Code Playgroud)
还有更多的CSS,但我很确定我玩过足够的东西来统治其他任何东西.
任何想法为什么会这样,如果它是平台/浏览器特定的,和/或任何修复?谢谢你的帮助!
我正在努力绕过碎片和活动.
我正在编写一个应用程序,它使用ActionBar来浏览"精选音频项目"列表,以及一个"程序"列表,其中包含自己的"音频项目"列表.我正在使用ActionBarSherlock和兼容包.
单击ActionBar选项卡时,它应显示该活动/片段.当您单击列表中的某些内容时,它应该打开一个显示该程序/音频项的新片段/活动.
我查看了各种演示/示例,并了解有几种方法可以做到这一点.
我的问题:
谢谢你提供的所有帮助
所以我已经采用了这种方法:
这是基于我在评论中提到的ActionbarSherlock FragmentLayoutSupport演示.
Main List Fragment片段:
//public class ProgrammesFragment extends SherlockListFragment
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
showDetails(id);
}
/**
* Helper function to show the details of a selected item, either by
* displaying a fragment in-place in the current UI, or starting a
* whole new activity in which it is displayed.
*/
void showDetails(long …Run Code Online (Sandbox Code Playgroud)