1
我試圖在我的Rails應用程序中使用液體模板語言,我看過Ryan Bates的視頻在軌道投下,我幾乎按照說明,但它似乎並沒有工作!液體模板不解析!
當我嘗試像
@template = Liquid::Template.parse("Hi {{name}}")
@template.render('name' => 'toby')
我得到
hi toby
,但是當我嘗試類似
category = Category.first
@template = Liquid::Template.parse("Hi {{category.name}}")
@template.render('category' => category)
我沒有得到期望的結果,我只得到
hi ""
有人可以幫我解決這個問題嗎?
原因是爲了防止像parse(「Hi {{category.destroy}}」)'搞亂你的數據。 – mckeed 2010-02-10 23:18:54
@SimoneCarletti此鏈接過期了,你能否更新你的答案。 – 2017-07-26 07:31:25
@RolandStuder更新 – 2017-07-28 17:36:25