フレームワーク

Controller傘下のページに、フレームワークを作成する。

コントローラーを作成する。

$ruby script/genereate controller main index

関連するページは下記のページ

  • /app/controllers/main_controller.rb
  • /app/views/main/index.rhtml
  • /app/views/layouts/frame_main.rhtml

#作成する。テンプレートページ

「/app/controllers/main_controller.rb」
class MainController < ApplicationController
layout 'frame_main'

mainコントローラー傘下は、/layout/main_frame.rhtmlを利用する。

「/app/views/layouts/frame_main.rhtml」
	<body>
		<%= yield :layout %>	
	</body>

元のindex.rhtml

「/app/views/main/index.rhtml」

何を書いてもよい。


http://localhost:3000/main/