Rails Engine

What is an Engine?

Engine is just a small application which can run within other Application. It has its own routes, assets, controllers, models, helpers, Views and even Gems

 

Bcui Main Application is also a kind of engine but with some added features. 

When would you need one?

Ideal case for engine is when you have a completely isolated domain from the main app. It has its own controllers, assets and models which doesn't share with rest of the App.

 

 

Two Kinds of Engine

1. Full Plugin

 

2. Mountable

 

Full Plugin

rails plugin new reader --full

  1. No Namespace
  2. Routes are accessible
  3. Main App's Layouts, Controllers, Views, Helpers all are shared 

Full Plugin

Potential Problems

  1. Higher chance of collision
    • ​​for eg. you create a controller ReadController in your Main App and then you created a ReadController in Full Plugin Engine then they both can overwrite each other
  2.  

Rails Engine

By amunda

Rails Engine

  • 23