开发者

Having migration scripts, models, controllers and route additions in a rails plugin

开发者 https://www.devze.com 2023-02-19 12:24 出处:网络
i\'m developing a modular application on RoR. Ideally, i\'d like to make a very generic kernel, and then to be able to code specific plugins around it (Placed in vendor/plugins, or in lib and then onl

i'm developing a modular application on RoR. Ideally, i'd like to make a very generic kernel, and then to be able to code specific plugins around it (Placed in vendor/plugins, or in lib and then only install the ones used by one set-up versus another set-up).

So my question is, is it possible to have any arbitrary model / controller / database migration script in a plugin, as well as additional routes? If it is possible, then how would it be organized in my application's folder hierarchy? Also, if it's possible, it would mean that upon installation, my plugin would have to tell rake to开发者_如何学Go migrate, and upon uninstallation it would have to have some "backup-and-drop" tables logic. How would that be doable?

Thanks a lot, Pierre.


Assuming you're working with Rails 3, you're describing exactly the behaviour of an engine.

See this gem to easily create yours (and eventually, bundle it as a gem): https://github.com/josevalim/enginex

0

精彩评论

暂无评论...
验证码 换一张
取 消