SlideShare a Scribd company logo
The Rails Engine That Could - In Motion
Problem
 Difficulty reusing functionality cutting across:
   Models
   Views
   Controllers
   Assets (JS, CSS, Images)
 Duplication across all web application layers.
Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
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
Example
                     Common
                     Domain
                       Rails Engine



          Search Map
             Rails Engine


  High School         Public           Athlete
   Recruiting        Profiles         Recruiting
      Rails App         Rails App        Rails App
Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
Overview
 Engines let applications reuse:
   Models / Views / Controllers / Helpers
   Assets (JS, CSS, Images)
   Routes
   Rake tasks
   Initializers
   RSpec / Cucumber
   More (migrations, seeds, libraries)
Engine Definition
 An engine structure is similar to a Rails app
 having app, config, lib, spec, features, etc…
 lib/engine_name.rb (read online instructions)
 lib/engine_name/engine.rb (read online
 instructions)
 To reuse engine, use “jeweler” gem to generate
 gemspec (read online instructions)
lib/engine_name.rb
lib/engine_name/engine.rb
Engine Consumption
    Reference engine via Gemfile as a Ruby gem or
    Git repo hosted gemified project:




Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
Load Order
 Typically Rails app files load first before Engine
 files.

 Strongly recommended to reverse (by patching
 “active_support/dependencies.rb”) so that
 engine’s Ruby code is overrideable in app (see
 next slide)

 ERB files can be overridden in Rails app
The Rails Engine That Could - In Motion
Ruby Code Customization
 Model/Helper/Controller behavior can be
 customized be redefining .rb files in Rails app:
   Add new methods/behavior
   Replace existing methods
   Extend existing methods via alias_method_chain
View Customization
 View files (erb, haml, etc…) and Asset files (js,
 css, and images) can be redefined in Rails app to
 override completely for customization purposes
Code Examples
Typical Development
Process
1. Make changes in engine, rake, and commit
   obtaining a new git ref
2. Update Gemfile in app with new git ref, run
   “bundle install” (getting ride of symlink)
3. Rake and commit changes in app.
4. If more changes in engine are needed go back
   to step 1
Improved Productivity via
Symlinking
 Multiple engine dependencies can hamper
 productivity when frequently going back and
 forth between engines and app
 Engines gems installed via bundler can be
 symlinked to allow continuous development until
 done with both app and
 engine:http://andymaleh.blogspot.com/2011/09/
 more-productive-rails-engine.html
Improved Development
Process
1. Open Rails app and symlink all engines “rake
   engine:symlink[engine_name]”
2. Work in app and engine until done WITHOUT running
   “bundle install”
3. Rake and commit changes in engine obtaining a new git
   ref
4. Update Gemfile in app with git ref, run “bundle install”
   (getting ride of symlink)
5. Rake and commit changes in app
Engines Reuse Engines
 Rails engines can reuse other Rails engines

 When multiple levels of depth are involved (e.g.
 App => Engine 1 => Engine 2), commit repos and
 update Gemfile from the bottom up (e.g. Engine
 2 => Engine 1 => App)
Engine Configuration
 Engines can be configured to customize rack
 middleware, load paths, generators, and Rails
 component paths. More details at:
 http://edgeapi.rubyonrails.org/classes/Rails/Engi
 ne.html
Isolated Engines
 To avoid Ruby namespace clash with
 Models/Helpers/Controllers, you can define an
 isolated namespaced engine:
Rails Engine Patterns
 Goals:
  Keep engine code agnostic of app customizations
  Prevent bi-directional coupling to simplify
  reasoning about code
  Avoid app dependent conditionals to improve code
  maintainability
Pattern - Common Domain
 Problem: Multiple applications need to share a
 basic domain model but want to customize
 behavior without mixing concerns across apps
 Solution:
  In engine, please basic domain model definitions
  and common associations only
  In each app, define specialized behavior and extra
  associations for domain models
Pattern - Expose Helper
 Problem: need to customize presentation logic
 for a view in one app only, but keep the same
 logic in others
 Solution:
  In engine, extract helper logic that needs
  customization into its own helper.
  In app, redefine that new helper with
  customizations.
Pattern - Expose Partial
 Problem: need to customize a part of the view in
 one app only, but keep it the same in others

 Solution:
  In engine, extract view part that needs
  customization as a partial.
  In app, redefine that partial with customizations.
Pattern - Extension Partial
 Problem: One app needs to add content to a
 view that is not needed in other apps
 Solution:
  In engine, introduce a new partial with empty
  contents in area that needs extension for the one
  app.
  In app, define that partial with the required
  content.
Pattern - Extension Partial



                                                             SIDEBAR
                                                             Extension
                                                              Partial



     Courtesy of © 2011 Groupon, Inc. All Rights Reserved.
Pattern - Extension Point
 Problem: different apps need to contribute data to a
 view in different places (e.g. contribute
 columns/rows in different spots)
 Solution:
   In engine, add logic that looks up partials in a specific
   ext directory, and based on file name (e.g.
   row_7.html.erb), determine index on where to insert it in
   the view.
   In app, define these partials with the right file names
   and locations.
Pattern - Extension Point

1

2

3


4

5
Pattern - Configurable
Features
 Problem: different apps need different features from
 an engine in different combinations
 Solution:
   In engine, add logic that looks up configuration options
   from a constant hash (e.g. ENGINE_XYZ_CONFIG =
   {:header => “visible”, :footer => “visible”, …}).
   In app, configure engine by overriding configuration
   options (e.g. ENGINE_XYZ_CONFIG[:header] =
   “hidden”)
Rails Engine Benefits
 Code reuse across all application layers

 Better maintainability due to:
   Independent project codebases
   Cleanly defined boundaries between projects and
   reusable components (engines)
 Project tests get smaller and run faster
Rails Engine Costs
 Overhead in establishing a new Rails Engine
 gem project

 Continuous switching between projects and
 engines to get work done

 Upgrade of ref numbers in Gemfile on every
 commit (minimized with symlinking)
More Info
 http://edgeapi.rubyonrails.org/classes/Rails/Engi
 ne.html

 http://andymaleh.blogspot.com/2011/09/more-
 productive-rails-engine.html

 http://stackoverflow.com/questions/2964050/rail
 s-engines-extending-
 functionality/2990539#2990539
Contact
 Andy Maleh
  Code Painter Blog http://andymaleh.blogspot.com
  Twitter: @AndyMaleh

More Related Content

What's hot (20)

PPT
Eclipse - Single Source;Three Runtimes
Suresh Krishna Madhuvarsu
 
PPTX
Getting Started with SharePoint 2013 Apps
Randy Williams
 
PDF
1 z0 543-q&a-demo-examarea
SamanthaGreen16
 
PPT
RAML - The architecture
Ankush Sharma
 
DOC
Hyperion planning what you should know
Amit Sharma
 
PDF
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Edureka!
 
PPTX
The API Facade Pattern: Common Patterns - Episode 2
Apigee | Google Cloud
 
PPTX
Anypoint access management - Roles
Shanky Gupta
 
PPTX
Plugin architecture (Extensible Application Architecture)
Chinmoy Mohanty
 
PDF
RAML
Shanky Gupta
 
PPTX
Meet AWS SAM
Eric Johnson
 
PPTX
Design API using RAML - basics
kunal vishe
 
PPTX
Adobe Ask the AEM Community Expert Session Oct 2016
AdobeMarketingCloud
 
PPTX
Anypoint access management
Shanky Gupta
 
PPTX
Rest With Raml
vijay dhanakodi
 
PPT
eRCP Overview and Update '06
Gorkem Ercan
 
PDF
Continuous Integration and Continuous Delivery for your serverless apps - Seb...
Shift Conference
 
PDF
Create Location Sharing apps using the Ionic framework
Shelly Megan
 
PDF
REST API Doc Best Practices
Marta Rauch
 
PDF
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
Salesforce Developers
 
Eclipse - Single Source;Three Runtimes
Suresh Krishna Madhuvarsu
 
Getting Started with SharePoint 2013 Apps
Randy Williams
 
1 z0 543-q&a-demo-examarea
SamanthaGreen16
 
RAML - The architecture
Ankush Sharma
 
Hyperion planning what you should know
Amit Sharma
 
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Edureka!
 
The API Facade Pattern: Common Patterns - Episode 2
Apigee | Google Cloud
 
Anypoint access management - Roles
Shanky Gupta
 
Plugin architecture (Extensible Application Architecture)
Chinmoy Mohanty
 
Meet AWS SAM
Eric Johnson
 
Design API using RAML - basics
kunal vishe
 
Adobe Ask the AEM Community Expert Session Oct 2016
AdobeMarketingCloud
 
Anypoint access management
Shanky Gupta
 
Rest With Raml
vijay dhanakodi
 
eRCP Overview and Update '06
Gorkem Ercan
 
Continuous Integration and Continuous Delivery for your serverless apps - Seb...
Shift Conference
 
Create Location Sharing apps using the Ionic framework
Shelly Megan
 
REST API Doc Best Practices
Marta Rauch
 
Quickly Build a Native Mobile App for Your Community Using Salesforce Mobile SDK
Salesforce Developers
 

Similar to The Rails Engine That Could - In Motion (20)

PPTX
The Rails Engine That Could
Andy Maleh
 
PPT
Rails review
Alan Hecht
 
PPT
Rails engines
Josh Schramm
 
PDF
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Mack Hardy
 
PPTX
Angular2 and You
Joseph Jorden
 
PPTX
Understanding angular js
Aayush Shrestha
 
PDF
Pluggable patterns
Corey Oordt
 
PPTX
Rails engine
Jyaasa Technologies
 
KEY
Backbonification for dummies - Arrrrug 10/1/2012
Dimitri de Putte
 
PDF
SPA Editor - Adobe Experience Manager Sites
Gabriel Walt
 
PPTX
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
DrupalCamp Kyiv
 
PDF
Introduction To Angular.js - SpringPeople
SpringPeople
 
PDF
Vue3: nuove funzionalità, differenze e come migrare
Andrea Campaci
 
PDF
Adobe Experience Manager Core Components
Gabriel Walt
 
PPTX
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
PDF
App Engine On Air: Munich
dion
 
DOCX
Top 10 Javascript Frameworks For Easy Web Development
Technostacks Infotech Pvt. Ltd.
 
PPT
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Michael Fons
 
PPTX
Angularjs2 presentation
dharisk
 
The Rails Engine That Could
Andy Maleh
 
Rails review
Alan Hecht
 
Rails engines
Josh Schramm
 
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Mack Hardy
 
Angular2 and You
Joseph Jorden
 
Understanding angular js
Aayush Shrestha
 
Pluggable patterns
Corey Oordt
 
Rails engine
Jyaasa Technologies
 
Backbonification for dummies - Arrrrug 10/1/2012
Dimitri de Putte
 
SPA Editor - Adobe Experience Manager Sites
Gabriel Walt
 
Oleg Bogut - Decoupled Drupal: how to build stable solution with JSON:API, Re...
DrupalCamp Kyiv
 
Introduction To Angular.js - SpringPeople
SpringPeople
 
Vue3: nuove funzionalità, differenze e come migrare
Andrea Campaci
 
Adobe Experience Manager Core Components
Gabriel Walt
 
Reactjs notes.pptx for web development- tutorial and theory
jobinThomas54
 
App Engine On Air: Munich
dion
 
Top 10 Javascript Frameworks For Easy Web Development
Technostacks Infotech Pvt. Ltd.
 
Metamorphosis from Forms to Java: A technical lead's perspective, part II
Michael Fons
 
Angularjs2 presentation
dharisk
 
Ad

More from Andy Maleh (14)

PDF
Fukuoka Ruby Award 2023 - Opal
Andy Maleh
 
PPTX
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Andy Maleh
 
PDF
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Andy Maleh
 
PPTX
How I Built My Code Editor in Ruby
Andy Maleh
 
PPTX
Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Andy Maleh
 
PPTX
RailsConf 2014 Recap at Montreal.rb by Andy Maleh
Andy Maleh
 
PPTX
Ultra Light and Maintainable Wizards in Rails at Montreal.rb
Andy Maleh
 
PPTX
Software Craftsmanship VS Software Engineering
Andy Maleh
 
PDF
Software Craftsmanship vs Software Engineering (Lightning Talk)
Andy Maleh
 
PDF
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Andy Maleh
 
PPTX
Software Design Trilogy Part II - Design Patterns for Rubyists
Andy Maleh
 
PPTX
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
Andy Maleh
 
PPTX
How I Learned To Apply Design Patterns
Andy Maleh
 
PDF
Simplifying Desktop Development With Glimmer
Andy Maleh
 
Fukuoka Ruby Award 2023 - Opal
Andy Maleh
 
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Andy Maleh
 
Montreal.rb 2022-10-05 - Glimmer DSL for SWT - Ruby Desktop Development GUI ...
Andy Maleh
 
How I Built My Code Editor in Ruby
Andy Maleh
 
Ultra Light and Maintainable Rails Wizards at RailsConf 2014
Andy Maleh
 
RailsConf 2014 Recap at Montreal.rb by Andy Maleh
Andy Maleh
 
Ultra Light and Maintainable Wizards in Rails at Montreal.rb
Andy Maleh
 
Software Craftsmanship VS Software Engineering
Andy Maleh
 
Software Craftsmanship vs Software Engineering (Lightning Talk)
Andy Maleh
 
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Andy Maleh
 
Software Design Trilogy Part II - Design Patterns for Rubyists
Andy Maleh
 
Software Design Trilogy Part I - Responsibility Driven Design for Rubyists
Andy Maleh
 
How I Learned To Apply Design Patterns
Andy Maleh
 
Simplifying Desktop Development With Glimmer
Andy Maleh
 
Ad

Recently uploaded (20)

PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Biography of Daniel Podor.pdf
Daniel Podor
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 

The Rails Engine That Could - In Motion

  • 2. Problem Difficulty reusing functionality cutting across: Models Views Controllers Assets (JS, CSS, Images) Duplication across all web application layers.
  • 3. Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
  • 4. 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
  • 5. Example Common Domain Rails Engine Search Map Rails Engine High School Public Athlete Recruiting Profiles Recruiting Rails App Rails App Rails App
  • 6. Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
  • 7. Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
  • 8. Overview Engines let applications reuse: Models / Views / Controllers / Helpers Assets (JS, CSS, Images) Routes Rake tasks Initializers RSpec / Cucumber More (migrations, seeds, libraries)
  • 9. Engine Definition An engine structure is similar to a Rails app having app, config, lib, spec, features, etc… lib/engine_name.rb (read online instructions) lib/engine_name/engine.rb (read online instructions) To reuse engine, use “jeweler” gem to generate gemspec (read online instructions)
  • 12. Engine Consumption Reference engine via Gemfile as a Ruby gem or Git repo hosted gemified project: Courtesy of © 2002-2011 National Collegiate Scouting Association - All Rights Reserved
  • 13. Load Order Typically Rails app files load first before Engine files. Strongly recommended to reverse (by patching “active_support/dependencies.rb”) so that engine’s Ruby code is overrideable in app (see next slide) ERB files can be overridden in Rails app
  • 15. Ruby Code Customization Model/Helper/Controller behavior can be customized be redefining .rb files in Rails app: Add new methods/behavior Replace existing methods Extend existing methods via alias_method_chain
  • 16. View Customization View files (erb, haml, etc…) and Asset files (js, css, and images) can be redefined in Rails app to override completely for customization purposes
  • 18. Typical Development Process 1. Make changes in engine, rake, and commit obtaining a new git ref 2. Update Gemfile in app with new git ref, run “bundle install” (getting ride of symlink) 3. Rake and commit changes in app. 4. If more changes in engine are needed go back to step 1
  • 19. Improved Productivity via Symlinking Multiple engine dependencies can hamper productivity when frequently going back and forth between engines and app Engines gems installed via bundler can be symlinked to allow continuous development until done with both app and engine:http://andymaleh.blogspot.com/2011/09/ more-productive-rails-engine.html
  • 20. Improved Development Process 1. Open Rails app and symlink all engines “rake engine:symlink[engine_name]” 2. Work in app and engine until done WITHOUT running “bundle install” 3. Rake and commit changes in engine obtaining a new git ref 4. Update Gemfile in app with git ref, run “bundle install” (getting ride of symlink) 5. Rake and commit changes in app
  • 21. Engines Reuse Engines Rails engines can reuse other Rails engines When multiple levels of depth are involved (e.g. App => Engine 1 => Engine 2), commit repos and update Gemfile from the bottom up (e.g. Engine 2 => Engine 1 => App)
  • 22. Engine Configuration Engines can be configured to customize rack middleware, load paths, generators, and Rails component paths. More details at: http://edgeapi.rubyonrails.org/classes/Rails/Engi ne.html
  • 23. Isolated Engines To avoid Ruby namespace clash with Models/Helpers/Controllers, you can define an isolated namespaced engine:
  • 24. Rails Engine Patterns Goals: Keep engine code agnostic of app customizations Prevent bi-directional coupling to simplify reasoning about code Avoid app dependent conditionals to improve code maintainability
  • 25. Pattern - Common Domain Problem: Multiple applications need to share a basic domain model but want to customize behavior without mixing concerns across apps Solution: In engine, please basic domain model definitions and common associations only In each app, define specialized behavior and extra associations for domain models
  • 26. Pattern - Expose Helper Problem: need to customize presentation logic for a view in one app only, but keep the same logic in others Solution: In engine, extract helper logic that needs customization into its own helper. In app, redefine that new helper with customizations.
  • 27. Pattern - Expose Partial Problem: need to customize a part of the view in one app only, but keep it the same in others Solution: In engine, extract view part that needs customization as a partial. In app, redefine that partial with customizations.
  • 28. Pattern - Extension Partial Problem: One app needs to add content to a view that is not needed in other apps Solution: In engine, introduce a new partial with empty contents in area that needs extension for the one app. In app, define that partial with the required content.
  • 29. Pattern - Extension Partial SIDEBAR Extension Partial Courtesy of © 2011 Groupon, Inc. All Rights Reserved.
  • 30. Pattern - Extension Point Problem: different apps need to contribute data to a view in different places (e.g. contribute columns/rows in different spots) Solution: In engine, add logic that looks up partials in a specific ext directory, and based on file name (e.g. row_7.html.erb), determine index on where to insert it in the view. In app, define these partials with the right file names and locations.
  • 31. Pattern - Extension Point 1 2 3 4 5
  • 32. Pattern - Configurable Features Problem: different apps need different features from an engine in different combinations Solution: In engine, add logic that looks up configuration options from a constant hash (e.g. ENGINE_XYZ_CONFIG = {:header => “visible”, :footer => “visible”, …}). In app, configure engine by overriding configuration options (e.g. ENGINE_XYZ_CONFIG[:header] = “hidden”)
  • 33. Rails Engine Benefits Code reuse across all application layers Better maintainability due to: Independent project codebases Cleanly defined boundaries between projects and reusable components (engines) Project tests get smaller and run faster
  • 34. Rails Engine Costs Overhead in establishing a new Rails Engine gem project Continuous switching between projects and engines to get work done Upgrade of ref numbers in Gemfile on every commit (minimized with symlinking)
  • 35. More Info http://edgeapi.rubyonrails.org/classes/Rails/Engi ne.html http://andymaleh.blogspot.com/2011/09/more- productive-rails-engine.html http://stackoverflow.com/questions/2964050/rail s-engines-extending- functionality/2990539#2990539
  • 36. Contact Andy Maleh Code Painter Blog http://andymaleh.blogspot.com Twitter: @AndyMaleh