Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have noticed the following: </p> <p><strong>Full Engine</strong></p> <p>With a full engine, the parent application inherits the routes from the engine. It is not necessary to specify anything in <code>parent_app/config/routes.rb</code>. Specifying the gem in Gemfile is enough for the parent app to inherit the models, routes etc. The engine routes are specified as: </p> <pre><code># my_engine/config/routes.rb Rails.application.routes.draw do # whatever end </code></pre> <p>No namespacing of models, controllers, etc. These are immediately accessible to the parent application. </p> <p><strong>Mountable Engine</strong></p> <p>The engine's namespace is isolated by default:</p> <pre><code># my_engine/lib/my_engine/engine.rb module MyEngine class Engine &lt; Rails::Engine isolate_namespace MyEngine end end </code></pre> <p>With a mountable engine, the routes are namespaced and the parent app can bundle this functionality under a single route: </p> <pre><code># my_engine/config/routes.rb MyEngine::Engine.routes.draw do #whatever end # parent_app/config/routes.rb ParentApp::Application.routes.draw do mount MyEngine::Engine =&gt; "/engine", :as =&gt; "namespaced" end </code></pre> <p>Models, controllers, etc are isolated from the parent application - although helpers can be shared easily. </p> <p>These are the main differences I have spotted. Perhaps there are others? I have asked over <a href="http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6a4691f62d0f1420">here</a>, but have yet to receive a response.</p> <p>My impression is that since a full engine does not isolate itself from the parent application, it is best used as a standalone application adjacent to the parent app. I believe name clashes could occur.</p> <p>A mountable engine could be used in situations where you want to avoid name conflicts and bundle the engine under one specific route in the parent application. For example, I am working on building my first engine designed for customer service. The parent application could bundle it's functionality under a single route such as:</p> <pre><code>mount Cornerstone::Engine =&gt; "/cornerstone", :as =&gt; "help" </code></pre> <p>If I'm way off in my assumptions, someone please let me know and I'll fix this response. I have made a small article about the subject <a href="http://www.astjohn.ca/2011/08/06/rails-31-engines-mountable-or-full-part-1/">here</a> Cheers!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload