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实在是很方便。
  • 相关阅读:
    vue基础笔记
    HM.DAY-02
    前端基础(三)
    前端基础 (二)
    前端基础(一)
    爬虫基础入门(二)
    爬虫基础入门(一)
    Python进阶(三)
    Python进阶(二)
    python切片
  • 原文地址:https://www.cnblogs.com/diegodu/p/5504944.html
Copyright © 2011-2022 走看看