zoukankan      html  css  js  c++  java
  • ruby rails

    http://www.zhihu.com/question/19552402
     
    作者:陈振宇
    链接:http://www.zhihu.com/question/19552402/answer/12367336
    来源:知乎
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

    先搞懂Rails的路由模式
    posts GET /posts(.:format) {:controller= > "posts", :action= > "index"}
    POST /posts(.:format) {:controller= > "posts", :action= > "create"}
    new_post GET /posts/new(.:format) {:controller= > "posts", :action= > "new"}
    edit_post GET /posts/:id/edit(.:format) {:controller= > "posts", :action= > "edit"}
    post GET /posts/:id(.:format) {:controller= > "posts", :action= > "show"}
    PUT /posts/:id(.:format) {:controller= > "posts", :action= > "update"}
    DELETE /posts/:id(.:format) {:controller= > "posts", :action= > "destroy"}
    通过rake routes你可以得到类似上面的路由记录,这样你就明白rails是如何通过路由来调用MVC里的C-controller里的方法了;
    然后再看看MVC里的M-model还有数据库迁移部分,剩下就是V-view了,重点是如何和javascript打交道的,Rails3和之前的版本都有不同。
    完成了这些就算入门了,然后就是逛github和这样的网站,了解下各个方面的插件。ps: Bundler实在是很方便。
  • 相关阅读:
    字符串 date 转标准 yyyyMMdd 格式
    stringBuild置空方法
    composer 加速
    php7.0 Mongodb 查询
    PHP7 mongo 操作
    php 简单的对称加密
    PHP 百度关键字
    php redis 写入读取的两个class
    php ci 框架自定义函数
    app已损坏,打不开,你应该将它移动到废纸篓
  • 原文地址:https://www.cnblogs.com/diegodu/p/5504944.html
Copyright © 2011-2022 走看看