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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
I take it no one has poked around with the Rails 3.1 engines yet? -Adam On Jul 25, 3:27 pm, astjohn <astj...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''m interested in this, too, but I haven''t used 3.1 yet. Let us know what you find out! On Thu, Jul 28, 2011 at 9:11 AM, astjohn <astjohn-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I take it no one has poked around with the Rails 3.1 engines yet?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 On Jul 28, 10:14 am, Paul <p...-mzPrHiy5csbYtjvyW6yDsg@public.gmane.org> wrote:> I''m interested in this, too, but I haven''t used 3.1 yet. Let us know > what you find out! > > > > > > > > On Thu, Jul 28, 2011 at 9:11 AM, astjohn <astj...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I take it no one has poked around with the Rails 3.1 engines yet?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Reasonably Related Threads
- rails 3 engine under dynamic scope
- Rails Engine ActionController::UrlGenerationError on functional tests
- Why does 'extend ActiveSupport::Concern' cause `undefined method 'recycle!'`?
- Engines issue: rake test_plugins failing when it shouldn''t
- Engines Generator & Howto Extract an Engine