Rails Engines/ Railties


I come to you after lots of investigations concerning Rails Engines. It appears (for a still young rails addict) that engines are not that documented, unless they seem so powerful.

Of course, I read the sources given int his post: http://groups.google.com/group/rubyonrails-talk/browse_frm/thread/2c10436165a63875/6f40b05c6ef6c189?lnk=gst&q=engines#6f40b05c6ef6c189 and other recommended in other posts but written in something like 2006...

The most interesting resource I found is this great initiative: https://github.com/krschacht/rails_3_engine_demo It would be great to make it a common starting point.

But it appears to be a bit buggy now... :frowning: I tried without success to dive into the code but without enough knowledge to get the problems.

Could anybody take a look at it? (the original author seems very busy the latest weeks). If ever you have an illustrated documentation for the dummy I admit to be, I'll of course try myself :slight_smile:

Thanks a lot,


What's your use-case? Theoretically you can stick a normal Rails (2.3.x) app under /vendor/ plugins and it will get picked up. Probably the most important part (in my view) is to namespace your plugin including the routes. E.g. we have a plugin which handles all site related stuff like users, sections, menus, groups so it has: - app   - controllers     - site       - groups       - menus       - sections       - users ...

in your routes you'd have:

ActionController::Routing::Routes.draw do |map|   map.namespace(:site) do |site|     site.resources :groups     site.resources :menus     site.resources :sections     site.resources :users   end end

If you start up your main app it will pick-up routes and classes from your plugin and make it available within the main application.

Best, Daniel