目前mvc,我就不多介绍了,网上一大堆

我从一个absolute beginer开始说吧

ruby scripts/rails generate controller say

这样我们就有了controller,  在 /app/controllers/ say_controller,然后,我在里面加了
def hello 
end

然后我在浏览器里输入localhost:3000/say/hello

No route matches [GET] "/say"最后找到了  /config/routes.rb 最后,把match ':controller(/:action(/:id(.:format)))' 注释去掉,这样就可以匹配到url了然后还说有问题,但是提示说在 /view/ 下没有erb文件,于是,根据提示,进入views后发现目录 layouts和say,看着有点感觉了吧,对了,就是进入say目录,写hello.html.erb
09-04 07:58