假設我將路由/
連接到WelcomeController的索引操作。Rails 3中的模板路徑
index.html.erb-Template內部我想從Rails.root向上顯示模板的路徑,即。
<h1> We are rendering: <%= how_do_i_do_this? %></h1>
渲染到
<h1> We are rendering: app/views/presentation/index.html.erb</h1>
在Rails 2我可以訪問template.path
,但是這並不能工作了
任何想法?
是的,這沒有工作。然而,它帶來的主要缺點是你不能將它分解成一個輔助方法,因爲這會搞砸__FILE__常量。 – flitzwald 2010-08-30 13:49:55