Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
rails cn
Search
blue planet
May 29, 2013
Programming
0
210
rails cn
Rails 简单介绍
blue planet
May 29, 2013
Tweet
Share
More Decks by blue planet
See All by blue planet
dapp 開発における big number の落とし穴 / Pitfalls of the big number in dapp development
blueplanet
0
120
join.me使用方法
blueplanet
0
120
Sublime Text 2 プラグイン開発 - ゼロからPackageControlへ登録まで
blueplanet
5
2k
Other Decks in Programming
See All in Programming
2024年のWebフロントエンドのふりかえりと2025年
sakito
1
160
Vue.jsでiOSアプリを作る方法
hal_spidernight
0
130
CNCF Project の作者が考えている OSS の運営
utam0k
5
630
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
220
時計仕掛けのCompose
mkeeda
1
240
いりゃあせ、PHPカンファレンス名古屋2025 / Welcome to PHP Conference Nagoya 2025
ttskch
1
240
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
150
Amazon Nova Reelの可能性
hideg
0
270
rails newと同時に型を書く
aki19035vc
6
750
2024年のkintone API振り返りと2025年 / kintone API look back in 2024
tasshi
0
190
Azure AI Foundryのご紹介
qt_luigi
1
260
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
1
200
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
51k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
Faster Mobile Websites
deanohume
306
31k
Statistics for Hackers
jakevdp
797
220k
Done Done
chrislema
182
16k
Gamification - CAS2011
davidbonilla
80
5.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
280
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Unsuck your backbone
ammeep
669
57k
Transcript
Ruby on Rails
ఏ纲 • Ruby 语ݴ • Ruby on Rails ᐽՍ •
ԋࣔ • Notes
Ruby 语ݴ • ٭ຊ语ݴ • ໘对 • 动态㜎ܕ • 语๏优ඒ
Ruby on Rails ᐽՍ • MVC WEB 䇖发ᐽՍ • FullStack
Ruby 语ݴ
RubyੋҰ㛭ՄҎࣸग़ 优ඒ码ɼ让䇖发ऀ ײ౸շ乐త语ݴ DHH - ຊITProࡃ访
٭ຊ语ݴ • ෆधཁ编译 • Ruby൛ Hello, world • $ ruby
-e 'puts "Hello, world !"'
໘对 • Ҏ㜎为ج础త໘对 • ॴ༗త东ੋ对 • “aaa”.class • 1.class
动态㜎ܕ • 变ྔᏠध໌㜎ܕ • ਵ时ՄҎमվ㜎ɺ对తߦ为
变ྔᏠध໌㜎ܕ • name = “yu” • age = 25 •
user = User.new
ਵ时ՄҎमվ㜎ɼ对తߦ为 class User def say “name is yu” end end
user = User.new user.say -> “name is yu” class User def hello “hello” end end user = User.new user.hello -> “hello”
语๏优ඒ • 变ྔෆधཁ㜎ܕ໌ • ׅ߸߸ՄҎলུ • @䇖头త为实ྫ变ྔ • @@䇖头త为㜎变ྔ •
େࣸతੋৗྔ
语๏优ඒ
Ruby on Rails ᐽՍ
历࢙ • 2004/07 First version • 2005/12 1.0 • 2007/12
2.0 • 2010/08 3.0 • 2013/05 4.0(rc1)
MVC • Model • View • Controller
http://japanese.railstutorial.org/chapters/a-demo-app
ཧ೦ • 约ఆ优ဋ设ஔ Convention over Configuration • ෆཁॏ䐾㟬ࣗݾ Don’t Repeat
Yourself
约ఆ优ဋஔ • User (Model) • models/user.rb • users (table in
DB)
约ఆ优ဋஔ • UsersController (Controller) • controllers/users_controller.rb
约ఆ优ဋஔ • users#index (View) • views/users/index.html.erb
ෆཁॏ䐾㟬ࣗݾ • Ұද • create_users.sql / ख动创ݐʁ • class User
... • User.xml • update_ver211to212.sql
ෆཁॏ䐾㟬ࣗݾ • Ұද • create_users.rb • class User ...
ෆཁॏ䐾㟬ࣗݾ • user.java • user.rb
user.java
user.rb
ํศతޭೳ • ֤䝅ੜث • 环ڥཧ • ਾ库൛ຊཧ • ߇੍
֤䝅ੜث • rails generate • controller • model • migration
• rails destory
级实༻త环ڥཧ • ᘍ认ࡾ环ڥ • 䇖发ʗ测试ʗੜ产 • Մࣗఆ义 • ࠜਾ环ڥෆಉ设ஔෆಉࢀ •
ൺɿ发ૹ邮݅༻త务ثᅿ
ํศతਾ库൛ຊཧ • rake db: • migrate / test:prepare • rollback
• reset • drop
߇੍ • rails console • Մҙ执ߦ码 • 查ਾ
ԋࣔ
༰ • ৽ݐrails项 • ༻rails g scaffold notes body •
⃧Ճ㜎