Your SlideShare is downloading. ×
0
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Ruby on Rails 简介
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Ruby on Rails 简介

795

Published on

Ruby on Rails introduction at dxy

Ruby on Rails introduction at dxy

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
795
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Ruby on Rails 简介 邱锦森
  • 2. Ruby on Rails 是什么由David Heninemeier Hansson从basecamp 中分离出来的MVC框架。由Ruby写成。谁是DHH ?37signals 合伙人, Rework, Getting Real, Agile WebDevelopment with Rails 作者之一。
  • 3. 为什么要用Rails,有什么好处? 约定优于配置 插件 强大的路由 ORM, Migrate 快速应付大部分应用场景 3种运行模式 development, test, production
  • 4. "模仿是最大的恭维" CakePHP(PHP)Playframework(JAVA) Grails(Groovy)
  • 5. Rails的设计原则“不要重复自己”(Dont Repeat Yourself)“约定优于配置”(Convention Over Configuration)例如: rest 请求CURD的action名具体的ruby类型到mysql类型如何映射,字段长度
  • 6. 什么时候适用?资料库形式,特别,不同于传统CMS的应用 性能要求不高 要求开发效率高 运行于*nix, Only POSIX
  • 7. 一个新的应用$rails new smart -J -d mysql$cd smart$bundle install$rake db:migrate$rails serverhttp://localhost:3000/
  • 8. 手脚架 scaffold$rails g scaffold post title:string content:text$rake db:migrate生成Model, View, Controller, Route
  • 9. 手脚架多余吗?不多余,因为“约定优于配置”,所以你也会那样写:)
  • 10. 添加一个作者字段生成Post时忘了添加某些字段?$rails g migration AddAuthorToPost author:string$rake db:migrate
  • 11. Routeresources :postsControllerclass PostsController < ApplicationController def show@post = Post.find(params[:id]) respond_to do |format|format.html format.xml { render :xml => @post } endendView<h1><%= raw(@post.title) %><h1>
  • 12. 输入验证?Modelclass User < ActiveRecord::Base validates :username, :length => { :within => 1..20, : message => 用户名长度必需为1-20 }, :uniqueness => trueend
  • 13. 一些资源网站Github -> Google Code Heroku -> Google App Engine各种RubycRuby Ruby Enterprise Edition 1 jRuby -> JAVA IronRuby插件 HAML -> HTML Rspec (BDD) -> Unit Test (TDD) Devise (用户验证)
  • 14. 感谢聆听:)

×