---
title: "Rails每周一题(二十二): Engines"
author: "andyhu1007"
date: "2009-12-01T20:34:05Z"
tags: []
categories: ["编程语言"]
slug: "rails-engines"
draft: false
lastmod: "2009-12-02T16:34:17Z"
id: 538518
url: "https://andyhu1007.iteye.com/blog/538518"
---

Rails世界有无数的各种各样的plugin，极大得助力了Rails应用程序的开发。但plugin的形式较为受限，Rails2.3推出engines plugin，旨在让人们更加方便地共享成果。

 

   它做了什么？

 

```
The engines plugin enhances Rails' own plugin framework, making it simple to share controllers, helpers, 
models, public assets, routes and migrations in plugins.
```

 

    这就好比，你的Rails应用是一个大机器，而它则可以依赖于其它架构一样的小机器（引擎）。因为架构的一致，从应用中抽取出引擎以共享会变得更加简单方便，这也鼓励更多的人来共享他们的成果。

 

    Engines plugin的安装非常简单：

 

```
ruby script/plugin install engines
```

 

    创建一个plugin的过程也非常简单：

 

    [writing\_a\_plugin\_with\_engines\_](http://web.archive.org/web/20080214094627/http://gwyn.dezyne.net/page/writing_a_plugin_with_engines_)

 

    References:

 

    [http://rails-engines.org/](http://rails-engines.org/)

 

    [http://github.com/lazyatom/engines](http://github.com/lazyatom/engines)

 

    --EOF--