我想在link_to中顯示產品數量,link_to是application.erb.html中部分顯示的一部分,問題是,我的應用控制器中有一個名爲products_on_cart的方法,它返回products count,when我試試這個代碼:link_to問題
<%= link_to "<%= products_on_cart%>", :controller=>"carts", :action=>"index"%>
軌給我一個錯誤:
"syntax error, unexpected '>'
...er=>"carts", :action=>"index"%>"
我真的不明白,爲什麼有人可以幫助我嗎?
出現另一個問題,現在軌道看不到我的products_on_cart方法是在應用控制器 – Maki 2011-05-19 12:25:00
在ApplicationController中: 是helper_method:products_on_cart – vicvega 2011-05-19 12:27:59
現在的作品,非常感謝 – Maki 2011-05-19 12:30:46