我目前正在为房地产应用程序构建 XML 导出。在 Rails 中使用 Builder gem。我正在寻找一种方法来执行以下操作:
<commercialRent>
"commercialRent figure"
<range>
...
</range>
</commercialRent>
我似乎找不到实现“文本在此处”部分的方法
我的代码:
b.commercialRent(period: "annual", plusOutgoings: self.plus_outgoings) {
self.rent_price;
b.range {
b.min(self.rent_psm_pa_min);
b.max(self.rent_psm_pa_max)
};
};
回报:
<commercialRent period="annual" plusOutgoings="no">
<rentPerSquareMeter>
<range>
<min>1000</min>
<max>10000</max>
</range>
</rentPerSquareMeter>
</commercialRent>
一切都打印正常,除了 self.rent_price 丢失。我想不通。