Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugin vs Engine in Rails 3, shipped as a gem

In the documentation for Rails::Plugin (for Rails 3), I'm reading the following:

"... you actually cannot declare a Rails::Engine inside your Plugin, otherwise it would cause the same files to be loaded twice. This means that if you want to ship an Engine as gem it cannot be used as plugin and vice-versa."

Can anyone be more specific about exactly what files get loaded twice? I have declared a plugin/gem as Engine, and it works fine also being put inside vendor/plugins (and I'd like to keep it this way), in spite of the statement above. I simply want some clarity on why (and whether) this is not a good thing to do.

Thank you!

like image 267
mxgrn Avatar asked Oct 26 '22 05:10

mxgrn


1 Answers

I don't have an exact answer myself, but this subject is covered in this resource which I have found helpful:

https://gist.github.com/e139fa787aa882c0aa9c

like image 193
Keith Schacht Avatar answered Nov 15 '22 02:11

Keith Schacht