the rails engine that could
DESCRIPTION
That talk covered a successful utilization of Rails Engines in Rails 3 to modularize MVC features as reusable components. These components provide the best of both worlds, DRY reusable and easy to maintain code that is also extensible and customizable in every way necessary.TRANSCRIPT
![Page 1: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/1.jpg)
The Rails Engine That
Could!!! Chooo Chooo!!!
Andy Maleh - Grouptiva
![Page 2: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/2.jpg)
Problem
Difficulty reusing functionality cutting across:
Models
Views
Controllers
Assets (JS, CSS, Images)
Duplication across all web application layers.
![Page 3: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/3.jpg)
Solution
Break common behavior into Rails Engines
Customize models/controllers/helpers in each project where needed by reopening classes
Customize Rails views in each project as needed by overriding templates
Link to Rails Engines in Gemfile via Git repo
![Page 4: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/4.jpg)
Example
Common DomainRails
Engine
Recruiting System
Rails App
Athlete Profiles
Rails App
Client System
Rails App
Search PageRails
Engine
![Page 5: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/5.jpg)
Benefits
Code reuse and productivity
Easier more organized maintainability
Minimize ripple effect when making changes
Project tests run faster by offloading some to Rails engines
![Page 6: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/6.jpg)
Cost
Overhead in establishing a new Rails Engine gem project
More complexity
Have to upgrade ref numbers in Gemfile on every change (could be offset by symlinking)
![Page 7: The Rails Engine That Could](https://reader035.vdocuments.site/reader035/viewer/2022062418/5551618eb4c905a8768b511b/html5/thumbnails/7.jpg)
More Info
http://edgeapi.rubyonrails.org/classes/Rails/Engine.html
http://andymaleh.blogspot.com