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文件删了估计也不会有用。
评论
javaworlds 2007-12-06
你在北京哪里上班呀,我在中关村这边上班,以后要多多向你请教,嘿嘿~!!!!
抛出异常的爱 2007-11-28
rake db:migrate
作用就是把db/migrate/目录下的所有数据文件加到数据库中去
但这个东西真的很麻烦
1:以后尽量一个改,否则死人死人。。
2:尽量不要用force,想要加字段减字段用 add_column :users, :activated, :boolean
如果用了force想要后退版本时会很麻烦
(第一次与第二次同时drop了一个同名的table)
3:index不用删,为了删index我又查了一下午,发现不是这回事。
4:text类型是没有初值的。当时大脑在想什么。。。迷糊。
发表评论

您还没有登录,请登录后发表评论

抛出异常的爱
搜索本博客
我的相册
1569dbfd-b702-3ce0-a83c-605b146f22c2-thumb
长椅
共 39 张
存档
最新评论