更新时间:2023-02-01 08:30:24
Rails 术语中的 Engine
实际上是 Web 应用程序的子应用程序.例如,博客、论坛或简单的身份验证之类的东西:这些不是成熟的应用程序,而是可以添加到任何 Rails 应用程序的页面/视图/控制器/模型.
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.
在 rails2 中,这将使用 plugin
来完成.现在,从 rails3 开始,引擎可以打包在 gem
中.
In rails2 this would be done using a plugin
. Now since rails3 an engine can be packaged in a gem
.
gem
是一个 ruby 库,可以在 http://rubygems.org上找到a> 并且这是将 ruby 代码打包并分发给其他 ruby 人员的标准(唯一)方式.
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 when will you use one or the other:
希望这会有所帮助.