I_am_tbag 发表于 2011-12-23 01:46

Ruby mvc ,不带数据库玩法

目前mvc,我就不多介绍了,网上一大堆<div><br></div><div>我从一个absolute beginer开始说吧</div><div><br></div><div>ruby scripts/rails generate controller say</div><div><br></div><div>这样我们就有了controller, &nbsp;在 /app/controllers/ say_controller,然后,我在里面加了</div><div>def hello&nbsp;</div><div>end</div><div><br></div><div>然后我在浏览器里输入localhost:3000/say/hello</div><div><br></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: helvetica, verdana, arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">No route matches "/say"最后找到了 &nbsp;/config/routes.rb 最后,把match ':controller(/:action(/:id(.:format)))'注释去掉,这样就可以匹配到url了然后还说有问题,但是提示说在 /view/ 下没有erb文件,于是,根据提示,进入views后发现目录 layouts和say,看着有点感觉了吧,对了,就是进入say目录,写hello.html.erb<br></span></div>
页: [1]
查看完整版本: Ruby mvc ,不带数据库玩法