nested_layout(・∀・)イイ!!
DRYですね、わかります。
http://wota.jp/ac/?date=20070706
しかしこれはこれで、特定のページだけレイアウトのheaderに*.jsやら*.cssへのリンクを追加したいときに
# hoge.html.erbで... <% content_for(:header) do %> <%= stylesheet_link_tag "aaa" %> <%= javascript_include_tag "prototype" %> <% end % # _layout.html.erbで... <header> <%= @content_for_header %> </header>
とか書いちゃったりして結局ブロックを使うことになってしまう罠。
あと、nestした_layoutでcontent_for(:header)使っちゃうと、hoge.html.erbでcontent_for(:header)使えないよね。content_for(:header2)とかしなきゃだめなんだろうか。うーん。
9/3追記
<% @content_for_header << javascript_include_tag "prototype" %>
こういう書き方もできるらしい。content_for(:header)の被りはなくなる。