Rails 3.1 Engines: Full vs. Mountable

Hi all,

I was hoping someone could please clarify the differences between a full engine and a mountable one.

I have noticed the following:

** Full Engine ** - With a full engine, the parent application inherits the routes from the engine. It is not necessary to specify anything in parent_app/ config/routes.rb. Specifying the gem in Gemfile is enough. The engine routes are specified as:

# my_engine/config/routes.rb Rails.application.routes.draw do # whatever end

- No namespacing of models, controllers, etc. These are immediately accessible to the parent application.

** Mountable Engine ** - The engine's namespace is isolated by default.

# my_engine/lib/my_engine/engine.rb module MyEngine   class Engine < Rails::Engine     isolate_namespace MyEngine   end end

- With a mountable engine, the routes are namespaced and the parent app can bundle this functionality under a single route:

# my_engine/config/routes.rb MyEngine::Engine.routes.draw do #whatever end

# parent_app/config/routes.rb Rails.application.routes.draw do   mount MyEngine::Engine => "/engine", :as => "namespaced" end

- Models, controllers, etc are isolated from the parent application - although helpers can be shared easily.

Is this correct and are these the main differences? Are there any other differences between a full and mountable engine that I missed?

Thanks, Adam

I take it no one has poked around with the Rails 3.1 engines yet?

-Adam

I'm interested in this, too, but I haven't used 3.1 yet. Let us know what you find out!

Hi Paul,

Here's what I have found so far:

http://www.astjohn.ca/blog/rails-31-engines-mountable-or-full-part-1

I'll post Part 2 later tonight. Hope that helps you out.

Cheers, Adam