Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Episode 1, Start Here (Rails Starter For China ...

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for Deshi Xiao Deshi Xiao
October 04, 2012

Episode 1, Start Here (Rails Starter For China Tech-Talk)

第一讲,重新认识Rails Web开发框架

开源课程- Rails Starter 2012,做最好的Rails入门课程
https://github.com/xiaods/rails-starter-for-china

Avatar for Deshi Xiao

Deshi Xiao

October 04, 2012
Tweet

More Decks by Deshi Xiao

Other Decks in Technology

Transcript

  1. 新手的痛苦 • 基本的编程概念不懂? • Ruby 语言有专门看过吗? • HTML, CSS, Javascript

    要懂到啥程度?我会复制别 人的网页算吗?! • 数据库我用过 MS SQL 可以吗? • Web 是什么,不就是网页吗?我懂!? • Git ,版本控制工具,我没用过
  2. 我们的约定 • Ruby 语言需要你课下练习,推荐 Rubymonk, 'I am having fun learning

    Ruby at http://rubymonk.com I like this type of lessens ;-)' quote from Yukihiro Matsumoto • Rails 版本持续保持在最新稳定版 • RubyGems 网站要了解,越多越好 • SQLite3 数据库要了解,越多越好 • No Windows, Only Linux, Fedora prefer!
  3. Rails 开发 Web 框架介绍 -Cont. • Rails philosophy • DRY

    – “Don’t Repeat Yourself” • Convention Over Configuration • REST is the best pattern for web applications
  4. Rails 开发 Web 框架介绍 -cont. • The MVC Architecture •

    Isolation of business logic from the user interface • Ease of keeping code DRY • Making it clear where different types of code belong for easier maintenance
  5. Rails 开发 Web 框架介绍 -cont. • The Components of Rails

    • Action Pack Action Controller Action Dispatch Action View • Action Mailer • Active Model • Active Record • Active Resource • Active Support • Railties
  6. Rails 开发 Web 框架介绍 • REST • Using resource identifiers

    such as URLs to represent resources. • Transferring representations of the state of that resource between system components.
  7. 创建我的第一个 Rails 项目 -Cont. • gem install rails • rails

    --version 1. rails new blog 2. rails db:create 3. rails server 4. rails generate controller home index 5. rm public/index.html 6. Edit app/views/home/index.html.erb, edit it to contain a single line of code:<h1>Hello, Rails!</h1> 7.Open the file config/routes.rb in your editor. Add this line of code: root :to => "home#index" 8.navigate to http://localhost:3000 in your browser, you’ll see Hello, Rails!.