views:

57

answers:

2

I have a Rails 2.3 application which I would like to extract into a plugin, or engine. The application has user authentication, and basic cms capabilities supported by ancestry plugin.

I want to extract the logic for the application into a plugin/engine so that I can use this code for future projects, with a different "skin" or "theme" if required.

I'm not entirely sure I actually understand the difference between plugin and engine concepts, so that would be a good first point.

What is the best approach, are there any good starting points, links, explanations, examples that I should follow. Also, with the release of R3 to consider, is there anything that I should be aware of for that, with regards to plugins etc.

I am going to start off by watching Ryan's http://railscasts.com/episodes/149-rails-engines but obviously thats over a year old now, so one of the challenges I'm faced with is finding the most up to date and relevant information on this subject.

All tips and help gratefully received.

A: 

Writing a plugin is an entirely different process than writing an app, if you already have your app code it should be straightforward converting it into a plugin.

Consider that if you use third-party plugins in your app it could get pretty messy.

benoror
+1  A: 

Actually, converting an application is pretty straigtforward. Just create a plugin-folder, put an app-folder inside containing all yor model-views-controllers folders, and that's it.

You will have to manage your migrations yourself though. Also you have to define rake-tasks to copy files to your public folder. I think the railscasts is still pretty up-to-date, if anything it is now easier in rails 2.3.

Good luck!

nathanvda