{"id":13669108,"url":"https://github.com/liwei78/rails-practice","last_synced_at":"2026-01-10T12:06:12.195Z","repository":{"id":27180439,"uuid":"30650274","full_name":"liwei78/rails-practice","owner":"liwei78","description":"《Rails 实践：使用 Rails 4 构建在线网店》","archived":false,"fork":false,"pushed_at":"2022-07-28T13:58:19.000Z","size":2936,"stargazers_count":50,"open_issues_count":9,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-11T05:39:09.491Z","etag":null,"topics":["rails","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"http://rails-practice.railsbook.cn/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liwei78.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-11T14:01:49.000Z","updated_at":"2023-08-21T22:55:21.000Z","dependencies_parsed_at":"2022-07-28T20:10:02.893Z","dependency_job_id":null,"html_url":"https://github.com/liwei78/rails-practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liwei78%2Frails-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liwei78%2Frails-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liwei78%2Frails-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liwei78%2Frails-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liwei78","download_url":"https://codeload.github.com/liwei78/rails-practice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251077102,"owners_count":21532607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rails","ruby","ruby-on-rails"],"created_at":"2024-08-02T08:01:02.320Z","updated_at":"2026-01-10T12:06:12.150Z","avatar_url":"https://github.com/liwei78.png","language":null,"readme":"# 写在前面\n\n你好，我是李玮，网名里克，2007年开始从事 Rails 开发工作。《Rails 实践：使用 Rails 4 构建在线网店》这本书，是我第一次编写完整的教程，对我来说，它更像是对过往经验的总结。\n\n本书通过一个在线网店程序的开发过程，带领大家了解 Rails 全貌。第一章，我们安装 Ruby 和 Rails 的开发环境，并学习如何设计项目 UI。第二章，我们讲解 Rails 中的资源含义，学习 Rails 如何实现 REST 风格架构，感受 Rails 的快捷开发。第三章，我们关注 Rails 的视图，从页面部分开始了解 MVC 框架。第四章，我们关注数据库部分，讲解 Rails 中的 M。第五章，我们在了解控制器的同时，完成我们网店的购买功能。第六章，我们学习 Rails 中的各种配置，并将它在云服务器上部署运行。\n\n在阅读本书同时，也希望你能阅读其他 Ruby 和 Rails 的教程，博客和新闻，增加知识储备。\n\n\u003e 写出正确的代码是需要理由的。\n\n## 目录\n\n* [写在前面](README.html)\n* 第一章 Ruby on Rails 概述\n   * [Ruby on Rails 开发环境介绍](Chapter_1/1.1.html)\n   * [Rails 文件简介](Chapter_1/1.2.html)\n   * [用户界面（UI）设计](Chapter_1/1.3.html)\n* 第二章 Rails 中的资源\n   * [应用 scaffold 命令创建资源](Chapter_2/2.1.html)\n   * [REST 架构](Chapter_2/2.2.html)\n   * [深入路由（routes）](Chapter_2/2.3.html)\n* 第三章 Rails 中的视图\n   * [布局和辅助方法](Chapter_3/3.1.html)\n   * [表单](Chapter_3/3.2.html)\n   * [视图中的 AJAX 交互](Chapter_3/3.3.html)\n   * [模板引擎的使用](Chapter_3/3.4.html)\n* 第四章 Rails 中的模型\n   * [模型的基础操作](Chapter_4/4.1.html)\n   * [深入模型查询](Chapter_4/4.2.html)\n   * [模型中的关联关系](Chapter_4/4.3.html)\n   * [模型中的校验](Chapter_4/4.4.html)\n   * [模型中的回调](Chapter_4/4.5.html)\n* 第五章 Rails 中的控制器\n   * [控制器中的方法](Chapter_5/5.1.html)\n   * [控制器中的逻辑](Chapter_5/5.2.html)\n* 第六章 Rails 的配置及部署\n   * [Assets 管理](Chapter_6/6.1.html)\n   * [缓存及缓存服务](Chapter_6/6.2.html)\n   * [异步任务及邮件发送](Chapter_6/6.3.html)\n   * [I18n](Chapter_6/6.4.html)\n   * [生产环境部署](Chapter_6/6.5.html)\n   * [常用 Gem](Chapter_6/6.6.html)\n* [写在后面](AFTER.html)\n\n## 电子版\n\n本书电子版为免费阅读，目前有两个指定的发布地址：\n\n独立域名：rails-practice.com （已过期）\n\n极客学院wiki：http://wiki.jikexueyuan.com/project/rails-practice/ （已无法打开）\n\n正式域名：http://rails-practice.railsbook.cn/\n\n## 当前版本\n\n1.1.0\n\n## 2022年7月更新说明\n\n* 启用独立的域名访问\n* 增加目录导航，方便阅读\n\n## 2017年2月更新说明\n\n* 书名更新为《Rails 实践：使用 Rails 4 构建在线网店》\n* 使用 Docker 作为开发调试环境，增加了 README.md，针对每一份代码有如何创建容器的说明\n* Ruby 版本更新为 2.3.3，请使用 `docker pull ruby:2.3.3` 镜像创建容器\n* Rails 版本统一更新为 4.2.7.1，请使用 `bundle update rails` 升级当前版本\n* 调整项目代码在当前 Ruby 和 Rails 版本下可正常运行\n* 更新 gems 数据源为 `https://gems.ruby-china.org`\n* 去掉了 .ruby-version 和 .ruby-gemset 两个文件\n* 结合大家在 issue 中反馈的问题进行调整\n* 精简部分代码\n* 修正 bug\n\n## 本书读者\n\n本书适合期望使用 Rails 制作 Web 网站的开发者，读者需要具备基础的 HTML，JS 和 CSS 知识，并且了解 Ruby 基本语法。你可以从未使用过 Ruby 和 Rails，这没关系，本书会带领你从安装 Ruby 环境开始，直到完成这个 Rails 项目。\n\n在学习的过程中，我建议读者注册一个 github.com 账号，建立一个学习笔记的代码仓库（Repo）中。\n\n## 本书约定\n\n* 名词首字母大写。\n* 英文缩写大写。\n* 命令小写。\n* 作为名词时，首字母大写，作为命令时 小写。Rails，Ruby 同。\n* 专有名词不翻译。\n* 专有名词按照约定书写，如 iPhone，iMac，html，js，css，php，jQuery 等等。\n* 中文和英文间留有空格。\n* 命令行中，当前用户操作使用 `%` 开头，root 用户操作，用 `$` 开头。\n\n## 版权声明\n\n本书的著作权归作者李玮（署名：里克）所有。\n\n你可以：\n\n* 下载、保存以及打印本书\n* 网络链接、转载本书的部分或者全部内容，但是必须在明显处提供读者访问本书发布网站的链接\n* 在你的程序中任意使用本书所附的程序代码，但是由本书的程序所引起的任何问题，作者不承担任何责任\n\n你不可以：\n\n* 以任何形式出售本书的电子版或者打印版\n* 擅自印刷、出版本书\n* 以纸媒出版为目的，改写、改编以及摘抄本书的内容\n\n## 读者反馈\n\n你可以在 [https://github.com/liwei78/rails-practice/issues](https://github.com/liwei78/rails-practice/issues) 页面写下你的问题，也可以留下意见和建议。\n\n## 示例代码\n\n[https://github.com/liwei78/rails-practice-code](https://github.com/liwei78/rails-practice-code)\n\n你可以 `fork` 这份代码到自己的代码仓库（Repo）中，修改并提交，然后向我的代码仓库提交 `Pull Request`，如果修改无异议，我将合并到 master 中。\n\n## 作者介绍\n\n李玮，网名里克，2007年开始从事 Rails 开发，先后经历过社会化搜索引擎 deyeb，华为生活社区百草网，电商平台等开发工作。在某网络安全公司从事产品开发。\n\n工作之余，担任长春心语志愿者协会网络顾问，编程教练以及80学院 Rails 导师。\n\n\n## 里克的自习室公众号\n\n![](images/railser.jpg)\n\n## 感谢\n\n感谢北京迅思科技及课程树团队中的每位成员。\n\n感谢所有关注过里克的自习室的朋友们。\n\n感谢 [Ruby China 社区](https://ruby-china.org) 让 Ruby 和 Rails 在中国充满活力。\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliwei78%2Frails-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliwei78%2Frails-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliwei78%2Frails-practice/lists"}