Write Software, Well
Rails Companion

Rails Companion

Learn to Build a Web Application in Ruby, without Rails

In this course, we'll build a simple but complete app in plain Ruby without Rails, to get a deeper understanding and appreciation of everything Rails does for us. Finally, we will deploy it to a web server, which will give you a good understanding of the deployment process for Ruby-based web applications, including Rails.

Table of Contents

57 chapters
  1. 1 Introduction
  2. 2 Setup Project Directory
  3. 3 Install Puma App Server
  4. 4 Install the Rack Gem
  5. 5 Create a Web Application
  6. 6 Make Puma Talk to Our App
  7. 7 Run the Application
  8. 8 Reload App when the Code Changes
  9. 9 Introduction to Rack
  10. 10 The Rack Protocol
  11. 11 The Rack Gem
  12. 12 Middleware Toolbox
  13. 13 Tools to Build Rack Apps + Middleware
  14. 14 The Rackup Command
  15. 15 Convenient DSL
  16. 16 What's Next?
  17. 17 Introduction to Router
  18. 18 What's a Router?
  19. 19 Current Setup
  20. 20 The Router Class
  21. 21 Using the Router
  22. 22 Step 1: Refactor the Router
  23. 23 Step 2: Create the Routes
  24. 24 Step 3: Update the App to Use New Routes
  25. 25 Pass HTTP Environment (Request to Routes)
  26. 26 Introduction to Controllers
  27. 27 What We'll Build
  28. 28 Step 1: Create a Controller Class
  29. 29 Step 2: Update the Router
  30. 30 Step 3: Add the Route
  31. 31 Refactoring: Extract Constructor to Base Controller
  32. 32 Serving Static Files
  33. 33 Separate View from Application
  34. 34 Make it Pretty with CSS
  35. 35 Serve Static Files via Middleware
  36. 36 Dynamic Views
  37. 37 Understanding the Concept of Binding
  38. 38 Using ERB with Binding
  39. 39 Step 1: Add a Render Method on Controller
  40. 40 Step 2: Render from Router
  41. 41 Create a View Template
  42. 42 Implement Logging
  43. 43 Logging in Ruby
  44. 44 Logging to a Log File
  45. 45 Log Levels
  46. 46 Log File Rotation
  47. 47 Adding Logging to Our Ruby App
  48. 48 Why Use Models?
  49. 49 Let's Add Models
  50. 50 Introduction to Zeitwerk
  51. 51 Using Zeitwerk to Load Constants
  52. 52 How Rails Configures Zeitwerk
  53. 53 Understanding the Concept of a Middleware
  54. 54 What is Middlware?
  55. 55 Why Use Middlware?
  56. 56 Let's Add Custom Middleware in Rails
  57. 57 Extract Logging Middleware