这几天看书自己写东西,有些东西很简单但花了不少时间

app/view/layouts
用来放layout文件
在controller里写
layout :"layout文件名"
就可以把对应的文件放入作好的layout模版中减少代码
render(:layout => flase)
禁用已有的layout
render(:layout => "layout/sameotherlayout"
改变layout
--------------------
[code]class DbaController < ApplicationController
def abc
redirect_to :controller=>:home, :action=>:index
end
end[/code]
[code]class HomeController < ApplicationController
def index

end
end[/code]
不同controll之间的action调用。
--------------------
config/routes.rb
map.home '', :controller => 'index' , :action => 'index'
设定index跳转的地方。。。当然如果你不把public下的index.html文件删了估计也不会有用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值