iRSSの日記

はてなダイアリーiRSSの日記の続き

テンプレートからrender :fileしたい

テンプレート内に、パーツを埋め込むときに、render :partial=> だと、appに下にファイルを入れなければならないし、ファイル名も、"_"で始まる必要がある。
このあたりの制限をなくしたくて、render :fileをためしたが、白紙になってしまった。

<%= render :file => "/path/to/file" %>
これは白紙に

render_fileというメソッドもあるので、それも挑戦したけど、だめ

<%= render_file "/path/to/file" %>
これも白紙に

しらべたら、以下の報告あり。

I have these two bits of code:<%= render_file @item.path, false %><%= render :file => @item.path, :layout => false %>

The first line works, the second doesn't (results in a blank page - nothing in the logs either).

If I change the first line to this, it also doesn't work:<%= render_file @item.path %>

This code is within a partial template, if that matters.

<%= render_file "/path/to/file",false %>
正解はこれだった!