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开发者_Python百科 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!
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
精彩评论