Mountable and Isolated Engines

In Chapter 5, ​Streaming Server Events to Clients Asynchronously​, we created a Rails engine that streams data to our application. In addition to providing a controller, the engine added new routes to our application, and helper methods like live_assets. In a way, that engine was directly extending our Rails application with its own components. However, this behavior is not always desirable.

Take for instance the plug-in we’ll build in this chapter. It’s going to provide its own models, controllers, and views. As the plug-in grows, the number of routes will start to multiply, as will the number of helper methods. If our plug-in implements a show_paginated_results helper and a Rails application uses our ...

Get Crafting Rails 4 Applications, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.