6. M
V
C
1
Router
ผู้ใช้เรียกดูข้อมูล
/resource/action
7. M
V
C
Controller
เราท์เตอร์เรียกใช้
2
คอนโทรลเลอร์
1
Router
ผู้ใช้เรียกดูข้อมูล
/resource/action
8. ดึงข้อมูล
M จากโมเดล
Model
V 3
C
Controller
เราท์เตอร์เรียกใช้
2
คอนโทรลเลอร์
1
Router
ผู้ใช้เรียกดูข้อมูล
/resource/action
9. ดึงข้อมูล 4
M จากโมเดล
Model
ดึงข้อมูล
V 3 จากฐานข้อมูล
C
Controller
เราท์เตอร์เรียกใช้
2
คอนโทรลเลอร์
1
Router
ผู้ใช้เรียกดูข้อมูล
/resource/action
10. ดึงข้อมูล 4
M จากโมเดล
Model
ดึงข้อมูล
V 3 จากฐานข้อมูล
C 5
Controller View
ประมวลผล
เราท์เตอร์เรียกใช้ ออกเป็นภาพ
2
คอนโทรลเลอร์
1
Router
ผู้ใช้เรียกดูข้อมูล
/resource/action
11. ดึงข้อมูล 4
M จากโมเดล
Model
ดึงข้อมูล
V 3 จากฐานข้อมูล
C 5
Controller View
ประมวลผล
เราท์เตอร์เรียกใช้ ออกเป็นภาพ 6
2
คอนโทรลเลอร์
1
Router
ผู้ใช้เรียกดูข้อมูล
/resource/action
18. โครงสร้างข้อมูลเบื้องต้นบนเรลส์
Post มีหลาย Comments Comment
Comment
Post
• title:string
• title:string
• body:text ขึ้นตรงกับ
has_many
• body:text • created_at:datetime
• created_at:datetime
belongs_to
• updated_at:datetime Post
• updated_at:datetime • post_id:integer (foreign_key)
belongs_to
• user_id:integer (foreign_key) &
• parent_id:integer
Comment
ขึ้นตรงกับ
User
• first_name:string
• last_name:string has_many
• email:string User
• password:string
User มีหลาย Comments
19. โครงสร้างข้อมูลเบื้องต้นบนเรลส์
Post มีหลาย Comments Comment
Comment
Post
• title:string
• title:string
• body:text ขึ้นตรงกับ
has_many
• body:text • created_at:datetime
• created_at:datetime
belongs_to
• updated_at:datetime Post
• updated_at:datetime • post_id:integer (foreign_key)
belongs_to
• user_id:integer (foreign_key) &
• parent_id:integer
Comment
ขึ้นตรงกับ
User
• first_name:string
• last_name:string has_many
• email:string User
• password:string
User มีหลาย Comments
คีย์นอกมักอยู่ที่ตัว ‘belongs_to’
20. ซอฟต์แวร์ที่ใช้พัฒนาบน OS X
Homebrew : http://mxcl.github.com/homebrew/
Rbenv : https://github.com/sstephenson/rbenv
MySQL : http://dev.mysql.com/downloads/