---
title: "这几天看书自己写东西，有些东西很简单但花了不少时间"
author: "抛出异常的爱"
date: "2007-11-28T10:32:42Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2007-11-28T10:32:42Z"
id: 144427
url: "https://loveexception.iteye.com/blog/144427"
---

app/view/layouts
用来放layout文件
在controller里写
layout :"layout文件名"
就可以把对应的文件放入作好的layout模版中减少代码
render(:layout => flase)
禁用已有的layout
render(:layout => "layout/sameotherlayout"
改变layout
--------------------

```
class DbaController < ApplicationController
  def abc
     redirect_to  :controller=>:home, :action=>:index
  end
end
```


```
class HomeController < ApplicationController
  def index
     
  end
end
```

不同controll之间的action调用。
--------------------
config/routes.rb
  map.home '', :controller => 'index' , :action => 'index'
设定index跳转的地方。。。当然如果你不把public下的index.html文件删了估计也不会有用。