Your Service Layer Needn't be Fancy, It Just Needs to Exist
summary
Argues for a simple Ruby on Rails service layer (plain classes and methods in app/services) instead of stuffing business rules into controllers or ActiveRecord callbacks, showing a concrete WidgetCreation class that queues jobs, emails admins, and updates sales notifications. Uses Rails autoloading and keeps ActiveRecord validations where they belong. Result is smaller controllers, easier tests, isolated changes that actually scale in real apps, and incremental organization via private methods, extracted services, namespaces, and optional lightweight base-service utilities.
AI-written summary · about
chapters (11)
- 0:00The problem with controllers
- 3:00Pitfalls of callbacks
- 5:18Understanding Rails roles
- 7:24Managing business logic
- 10:18Introducing the service layer
- 12:24Implementing services
- 14:32Stability and testing benefits
- 17:42Reconciling trade-offs
- 19:29Scaling and organizing
- 22:17Conclusion and advice
- 25:29Q&A session
related talks
34mSimple and Elegant Rails Code with Functional Style
39mExploring Rails anti-patterns
31mMissing Guide to Service Objects in Rails
34mSOA and the Monolithic Rails App Anti-Pattern
46mRails as a piece of birthday cake
36mIn Relentless Pursuit of REST
23mAbstracting a Service - A Case Study in Forward Thinking with SOA
37mRails as an SOA Client
