• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

scaffold時に自動生成されるテンプレートファイルの場所を調べてみた。


環境

  • JRuby 1.1.4
  • Rails 2.1.1


jruby/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails_generator/generators/components/scaffold/templates/

layout.html.erbをXHTML 1.0 Strictに書き換えてみる。

   1  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
   2  
   3  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
   4  <head>
   5    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
   6    <title><%= controller_class_name %>: <%%= controller.action_name %></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 Png abikounso on Fri 26 Sep 2008 at 12:47

Search Words:

  • scaffold27 rails26 2.112 active5 layout3 s22 stylesheet_link_tag2 テンプレート2 scaffolding2 2.1.11 無い1 プラグイン1 レイアウト1 yield1 テンプレートファイル1 2.1.31 1.1 layoutファイル1 'scaffold1 レイアウトファイル1 search1 'scaffold'1 activescaffold1 head1 doctype1

Comments:

or Preview
Tags
rails
Social Bookmarks
  • Delicious
  • B_entry911
  • Clip_16_12_w911