matt swanson 😈 Profile picture
🎯 Building https://t.co/3G3n0iVnIn 🔥 Ruby on Rails tips 📻 https://t.co/MMIvlQpzwD ✌️ All killer, no filler 🍊 Karl Pilkington is my spirit animal
Sep 9, 2022 7 tweets 2 min read
Really digging this pattern for organizing different 'features' of a model.

Keeps related methods together and makes it easier to find relevant code as the codebase grows. Plus I can separate out test files by feature. Image Example: Tasks::DueDate

Tasks originally just had a due_date field. Eventually that grew to also support relative due dates ("10 days from start"). And we wanted a handful of helpers like `due_this_week?` and `overdue?`.

100 lines in a well-name module > 100 lines in the model