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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
blue planet
May 29, 2013
Programming
220
0
Share
rails cn
Rails 简单介绍
blue planet
May 29, 2013
More Decks by blue planet
See All by blue planet
dapp 開発における big number の落とし穴 / Pitfalls of the big number in dapp development
blueplanet
0
130
join.me使用方法
blueplanet
0
130
Sublime Text 2 プラグイン開発 - ゼロからPackageControlへ登録まで
blueplanet
5
2.1k
Other Decks in Programming
See All in Programming
ECR拡張スキャンでSBOMを収集して サプライチェーン攻撃の影響調査を 爆速で終わらせてみた
akihisaikeda
1
160
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
580
Modding RubyKaigi for Myself
yui_knk
0
310
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
270
Agent Skills を社内で育てる仕組み作り
jackchuka
1
2.2k
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
190
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
120
なぜあなたのコードには「コシ」がないのか?〜AI時代に問う、最後まで美味しい設計と戦略〜 #phpconkagawa / phpconkagawa2026
shogogg
0
210
ReactとSvelteのその先、Ripple-TS / Beyond React and Svelte: Ripple-TS
ssssota
2
370
My daily life on Ruby
a_matsuda
3
420
Firefoxにコントリビューションして得られた学び
ken7253
2
170
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
3.2k
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
180
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
250
The untapped power of vector embeddings
frankvandijk
2
1.7k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
First, design no harm
axbom
PRO
2
1.2k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
150
How to make the Groovebox
asonas
2
2.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
170
Agile that works and the tools we love
rasmusluckow
331
21k
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 •
⃧Ճ㜎