Start Your (Rails) Engines!
Learn the basics of building and integrating Rails Engines, and consider when they are or aren't the best solution.
Slides
About this talk
Want to split up your Rails app into pieces but not sure where to begin? Wish you could share controller code among microservices but don’t know how? Do you work on lots of projects and have boilerplate Rails code repeated in each?
Rails Engines may be your answer. We build a simple Rails engine and explore how this app-within-an-app architecture helps you write more modular code that can be gemified and reused across multiple projects.
Live Code & Notes
You can check out the code from the live-coding portion in amcaplan/forget and amcaplan/cacher, along with my edited notes.
Links from the Presentation
- Getting Started with Engines — Rails Guides
Rails::Applicationsource- Why Engines and Components Are Not Evil (Just Distracting)
- Rails-core engines discussion
- Open Sourcing with Rails Engines — LivingSocial Tech Blog
Further Information
- GoGaRuCo 2012, Erik Michaels-Ober — “Writing a Rails Engine”
- Ben Smith — “Leave your migrations in your Rails engines”
- RailsConf 2015, Stephan Hagemann — “Get started with Component-based Rails applications!”
- Brian Leonard — “Rails 4 Engines”
- Rocky Mountain Ruby 2013, Ben Smith — “How I architected my big Rails app for success!”
- Stephan Hagemann — “Migrating from a single Rails app to a suite of Rails engines”
- Will Read — “Experience Report: Engine Usage That Didn’t Work”