What is the difference between the two and when one should be used instead of the other?
1 What are Engines? 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 .
Mount within the Rails routes does the equivalent of a Unix mount . It actually tells the app that another application (usually a Rack application) exists on that location. It is used mostly for Rails Engines.
An Engine
in rails terminology is a actually a subapplication of a web-application. For instance, something like a blog, a forum, or simple authentication: these are not full-blown applications, but pages/views/controllers/models that can be added to any rails application.
In rails2 this would be done using a plugin
. Now since rails3 an engine can be packaged in a gem
.
A gem
is a ruby library, which can be found on http://rubygems.org and it is the standard (only) way to package and distribute ruby code to other rubyists.
So to conclude:
So when will you use one or the other:
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With