我使用紅寶石模板來生成鏈接。這工作:我可以傳遞一個數字作爲數據對象中的鍵嗎?
<% link_to t('features.cta_link')+link_id('features'),
data: { test: t('header.button') } do %>
但我想設置數據,屬性數據-2,所以我嘗試
<% link_to t('features.cta_link')+link_id('features'),
data: { 2: t('header.button') } do %>
但後來我得到
unexpected ':', expecting => ...ion', itemscope: '', data: { 2: t('header.button') } do ...^
爲什麼要傳遞一個數字? – RSB
嘗試'{「2」:...}' – Amadan
沒有工作.... – Himmators