26th
Fri
Railsのscaffold用テンプレートファイルってどこにあるの?
scaffold時に自動生成されるテンプレートファイルの場所を調べてみた。
環境
- JRuby 1.1.4
- Rails 2.1.1
jruby/lib/ruby/gems/ 1.8/gems/r ails-2.1.1 /lib/rails _generator /generator s/componen ts/scaffol d/template s/
layout.htm
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN " "http://www .w3.org/TR /xhtml1/DT D/xhtml1-s trict.dtd"> 2 3 <html xmlns="http://www .w3.org/19 99/xhtml" xml:lang="ja" lang="ja"> 4 <head> 5 <meta http-equiv ="content-ty pe" content="text/html;charset=UT F-8" /> 6 <title><%= controller _class_nam e %>: <%%= controller .action_nam e %></title> 7 <%%= stylesheet _link_tag 'scaffold' %> 8 </head> 9 <body> 10 11 <p style="color: green"><%%= flash[:notice] %></p> 12 13 <%%= yield %> 14 15 </body> 16 </html>
これで、次回のscaffoldから、上記のレイアウトファイルが出力されるようになる。
ただし、Railsをアップデートすると元に戻ってしまうので注意。
posted by
abikounso
on Fri 26 Sep 2008
at 12:47



Comments: