Ruby on Rails

Rails -Engines

Introduction#

Engines can be considered miniature applications that provide functionality to their host applications. A Rails application is actually just a “supercharged” engine, with the Rails::Application class inheriting a lot of its behavior from Rails::Engine.

Engines are the reusable rails applications/plugins. It works like a Gem. Famous engines are Device, Spree gems which can be integrated with rails applications easily.

Syntax#

  • rails plugin new [engine name] --mountable

Parameters#

Parameters Purpose
—mountable option tells the generator that you want to create a “mountable” and namespace-isolated engine
—full option tells the generator that you want to create an engine, including a skeleton structure
## Remarks#
Engines are very good options for creating reusable plugin for rails application
## Famous examples are
Generating simple blog engine
rails plugin new [engine name] --mountable

Famous engines examples are

Device (authentication gem for rails)

Spree (Ecommerce)


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow