Email the Author

You can use this page to email Luís Ferreira about Start Your Engines.

Please include an email address so the author can respond to your query

This message will be sent to Luís Ferreira

This site is protected by reCAPTCHA and the Google  Privacy Policy and  Terms of Service apply.

About the Book

Ruby on Rails is one of the most used frameworks for web development and it is used even more by companies providing SaaS. In my opinion SaaS should be all about modularity, and that's where Rails Engines come in. So, if you're doing SaaS, want to create RoR Engines or just want to learn one of the coolest things in RoR, this book is for you! ;)

It will focus mainly on:

  1. How to create an engine
  2. Best practices for developing an engine
  3. A bit of metaprogramming (one of the most essential parts of building engines, IMO)
  4. Testing
  5. Deploying (i.e, merging with an actual app)

This is obviously subject to major refactoring until the book is published.

Here's the intro so you can have a little taste. Enjoy.

A little bit of History

Rails applications have evolved a whole lot throughout the years so, before even talking about engines let's take a step back and look at that nasty beast that were plugins.

Plugins and Engines are very much alike in terms of the problem then intend to solve, that is when you want to experiment on new stuff without hurting the stable code base or just modularize your code so that it is more easily tested, maintained and reused. They do, however, have some differences in how they approach this problem.

Prior to rails 3 plugins would live in the vendor/plugin directory and they would work fine if what you wanted was to extend ActiveRecord or String or any other class. On the other hand if you wanted like to add an actual model, controller, asset or even migration, brace yourself, your were in for a real treat.

Adding a controller would involve creating a generator that would copy it to the correct folder in the app, and the same goes for assets and migrations. This not only was a tedious job as it defeats one of the reasons we were using plugins in the first place, since it merges the plugin code with the application code. What a mess!*

As you might imagine these are just some of the more obvious problems with rails 2 plugins and quite frankly I think this is why nobody really used them.

When rails 3 came out the concept of engines came with it, these were plugins but were bundled in a gem. They were not quite as spectacular as they are today and I will not give them too much attention, I just want to mention a gem that was written by José Valim, a core Rails contributor, called Enginex. What this gem does is scaffold an engine with all the structure you need, as well as some very helpful boilerplate code.

At the time rails 3.1 was released, Enginex was bundled together with it bringing some other nice tweaks. This was the dawn of the age of the Engines!

*Some of them were actually more inteligent than this, but with practically no support from rails itself, it was a hard task.


About the Author

Luís Ferreira’s avatar Luís Ferreira

@zamith

CTO, Developer and Major Geek at Group Buddies.

Co-Fouder of Minho.RB.

Sports Lover.

Logo white 96 67 2x

Publish Early, Publish Often

  • Path
  • There are many paths, but the one you're on right now on Leanpub is:
  • Start-engines › Email Author › New
    • READERS
    • Newsletters
    • Weekly Sale
    • Monthly Sale
    • Store
    • Home
    • Redeem a Token
    • Search
    • Support
    • Leanpub FAQ
    • Leanpub Author FAQ
    • Search our Help Center
    • How to Contact Us
    • FRONTMATTER PODCAST
    • Featured Episode
    • Episode List
    • MEMBERSHIPS
    • Reader Memberships
    • Department Reader Memberships
    • Author Memberships
    • Your Membership
    • COMPANY
    • About
    • About Leanpub
    • Blog
    • Contact
    • Press
    • Essays
    • AI Services
    • Imagine a world...
    • Manifesto
    • More
    • Partner Program
    • Causes
    • Accessibility
    • AUTHORS
    • Write and Publish on Leanpub
    • Create a Book
    • Create a Bundle
    • Create a Course
    • Create a Track
    • Testimonials
    • Why Leanpub
    • Services
    • TranslateAI
    • PublishWord
    • Publish on Amazon
    • CourseAI
    • GlobalAuthor
    • Marketing Packages
    • IndexAI
    • Author Newsletter
    • The Leanpub Author Update
    • Author Support
    • Author Help Center
    • Leanpub Authors Forum
    • The Leanpub Manual
    • Supported Languages
    • The LFM Manual
    • Markua Manual
    • API Docs
    • Organizations
    • Learn More
    • Sign Up
    • LEGAL
    • Terms of Service
    • Copyright Policy
    • Privacy Policy
    • Refund Policy

*   *   *

Leanpub is copyright © 2010-2025 Ruboss Technology Corp.
All rights reserved.

This site is protected by reCAPTCHA
and the Google  Privacy Policy and  Terms of Service apply.

Leanpub requires cookies in order to provide you the best experience. Dismiss