หนังสือสอน Ruby on Rails สร้าง API ตั้งแต่เตรียมเครื่อง ยันเขียนเป็น

หนังสือสอน Ruby on Rails สร้าง API ตั้งแต่เตรียมเครื่อง ยันเขียนเป็น

ใครสนใจเขียน Ruby on Rails ลองเข้ามาอ่านดูครับ

เกิดอยากจะเป็นโปรแกรมเมอร์ สารบัญ

เนื้อหาของหนังสือมีดังนี้ครับ

  • บทท่ี 1 - เตรียมเครื่อง
    • rvm / Install Ruby
    • nvm / Install NodeJS (optional) Ruby on Rails
    • Text Editor
    • Postman / Hoppscoth
  • บทท่ี 2 - สร้าง Project
  • บทท่ี 3 - Folders และ Files
    • root Folder
    • config Folder
    • app Folder
    • Files อื่นๆ
  • บทท่ี 4 - ภาษา Ruby
    • Numbers
    • String
    • Comment
    • puts และ print
    • Array
    • Hash
    • if / else / elsif / end
    • Boolean
    • Case (switch)
    • Loops (for ,while, each)
    • map
    • implicit / explicit return
    • Code Block 30 Class / Object
    • Subclass
    • Modify Build-in Class
  • บทท่ี 5 - Controllers
    • Static API [GET]
    • Request with curl
    • CORs / Hoppscotch
    • POST/PUT/PATCH/DELETE
  • บทท่ี 6 - Model / Database
    • ActiveRecord
    • Model / Table Design
    • Code First Database Migration
    • การแก้ไขโครงสร้าง Database
    • การเขียนข้อมูลด้วย Rails Console
  • บทท่ี 7 - CRUD REST API
    • New project
    • REST APIs
    • Generating Controllers
    • GET users#index
    • POST users#create
    • GET users#show
    • PUT/PATCH users#update
    • DELETE users#destroy
  • บทท่ี 8 - Scaffolding
    • rails g scaffold
    • ทดสอบ API จาก scaffold
  • บทท่ี 9 - Model Relationships
    • Defining Relationships
  • บทท่ี 10 - Sending Emails
    • Mailgun
    • ActionMailer Basic
    • Sending Real emails
  • บทท่ี 11 - Errors Handling
    • rescue
    • throwing errors
    • Custom Error Class
    • Catching Errors in Controller
    • Other errors to rescue
  • บทท่ี 12 - Authenticating APIs
    • devise gem
    • JWT
    • Model callbacks
    • Sessions Controller
    • Sign up API
    • Sign in API
    • Profile API
    • Sign out API
    • Catching JWT / API Errors
  • บทท่ี 13 - Model Validation
    • Presence
    • Inclusion
    • Length / Number
    • Custom Validation
  • บทท่ี 14 - Query Interfaces
    • .find / .findby?
    • .where / .where.not
    • Date Query
    • Scope
    • Scope with function
    • Ordering
    • Readonly Object
    • JOIN
    • Eager Load / N+1 Query
    • Selecting Fields to Query
    • Calculations
  • บทท่ี 15 - Caching with Rails
    • Installing REDIS
    • Configuring Rails
    • Simple Cache Key
    • Caching Model
  • บทท่ี 16 - Delayed Jobs
    • ActiveJob
    • Using with Mailer
  • บทท่ี 17 - Uploading files / Images
    • ActiveStorage
    • Upload Image API
    • multipart/form-data
    • Auto Resize Images
    • File Validation
    • Storage Config
  • บทท่ี 18 - Model / State Machine
    • AASM
    • States
    • Events
    • Callbacks
  • บทท่ี 19 - Unit Test
    • Rails test
    • Test Driven Development (TDD)
    • Fixtures
    • Parallels Testing
  • บทท่ี 20 - Searching Database
    • Preparation / Database Seed
    • SQL Search / Ransack
    • SQL Multi-column Ransack
    • ElasticSearch / Searchkick
  • บทที 21 - Security / Credentials
    • rails credentials
  • บทท่ี 22 - Deploying Rails
    • Server Preparation (Ubuntu)
    • Adding new user to Server
    • Installing Rails / NGINX
    • Deploying Code
    • Nginx & Passenger Config
    • SSL / Let’s Encrypt Config
    • Dockerfile

สำหรับ Video สอน

ผมพยายามทำและรวบรวมวีดีโอที่ผมทำเอง และ ถ้าเป็นไปได้จะพยายามเอาวีดีโออื่นๆที่เกี่ยวข้องมารวมด้วยครับ (ข้ามไปดูวีดีโอด้านล่างสุดได้เลยครับ สำหรับคนใจร้อน)

Youtube Channel SaKKosama 🐶 กดติดตามหน่อยนะครับ

เป้าหมายคือ อยากให้เป็นประโยชน์กับทุกๆคน ไม่ว่าจะพนักงานของผมเอง หรือ จะเป็นคนที่มีความสนใจศึกษา Ruby on Rails และอยากให้มี Developer ชาวไทยหันมาใช้งาน Ruby on Rails กันให้เยอะขึ้นครับ

ปล. Web dev.to นี้ก็เขียนด้วย Ruby on Rails นะครับ

List ข้อดีของ Ruby on Rails

  1. Ruby เป็นภาษาที่ สามารถอ่านได้ง่าย เข้าใจง่าย
  2. Rails เป็น Framework ที่มี High standard และ Convention ที่ดีมากๆ ดีขนาดที่ทุกๆ Framework พยายามนำไปเปรียบเทียบ
  3. คนชอบบอกว่า High Learning Curve แต่สำหรับผม มันขึ้นอยู่กับว่า เริ่มอย่างไรมากกว่า
  4. Rails เป็น Framework ที่มีครบเกือบจะทุกอย่างที่ Developer ต้องการสำหรับ Web Development
  5. Rails เป็น Framework ที่ทำให้สามารถพัฒนาระบบอะไรก็ตามได้อย่างรวดเร็ว และ สามารถทำการเปลี่ยนแปลง feature ต่างๆ ได้โดยง่าย
  6. Rails ตั้งแต่ Rails 5 ขึ้นมา มีการใส่ Test Driven Development ได้โดยง่าย ไม่ว่าจะเป็น Unit test, Integration test ในทุกๆเรื่อง โดยที่มีการกำหนดวิธีเขียนมี standard อย่างชัดเจน
  7. Rails มี Security Standard ที่ชัดเจน หากทำตามที่ Framework กำหนด มีความปลอดภัยในการทำสูงมาก
  8. Rails caching mechanism ดีมากๆ ไม่ว่าจะเป็น Query Cache, Redis Cache รับรองว่าใช้แล้วจะแปลกใจทำไมภาษาอื่นไม่มี

List ข้อด้อยของ Ruby on Rails ที่คนชอบบ่นกัน

  1. หลักๆเลยคือ ช้า... คนบ่นทุกคน แต่มันก็พอๆกะ Python (Django)
  2. Scale ยาก เพราะว่ามันช้า มันเลย Require scaling เยอะกว่าคนอื่น
  3. พึ่งพา gem เยอะ และอาจจะทำให้ไม่ค่อย Flexible หากเลือกไม่ดี (เป็นเหมือนกันทุกภาษา)
  4. Learning curve / Learning Material เอาจริงๆ ผมว่าขึ้นอยู่กะคน

สรุปความคิดเห็นส่วนตัว

  • ภาษาที่เขียนง่าย อ่านง่าย จะทำให้ Maintain ง่ายขึ้น ผมเปิดบริษัทมาร่วมสิบปี Maintain Rails เป็นอะไรที่สบายที่สุด แต่ NodeJS เป็นอะไรที่ทรมานที่สุด
  • ภาษาที่เขียนง่าย ทำให้สามารถเขียน function ยากๆได้ง่ายขึ้น ภาษาที่เร็วๆ เขียนไม่ดีมันก็ช้าได้
  • Function ไหนอยากให้เร็วขึ้น
    • หาทางทำ Caching
    • Optimize query
    • ย้ายไปทำ Microservice แยก เอาก็ได้

พิมมาเยอะ ใครเห็นด้วยไม่เห็นด้วยก็ติชมได้ครับ จะพยายามปรับให้ดีขึ้นเรื่อยๆครับ ขอบคุณครับ

วิีดีโอ

@geekstart LINE QR

วิธีการซื้อหนังสือ

สั่งซื้อผ่าน Shopee ราคา 489 บาท
soontobeprogrammer shopee buy button