Search code examples
ruby-on-railsdesign-patternscode-reuse

Rails reusable web component designs


Developing rails has become lots of fun over the year that I've done it, but now I came to a point where I need to build reusable website components such as a Webshop, ContentManagement, MediaManagement, etc.

We want to reduce time and costs for our upcoming clients, and we have a little gap where we can spend time doing building these things.

So what I want to build is a CMS that I can drop in a project with just a single folder and one or two lines of code to initialize the CMS and tell it what to use and what not. So that after that, we only need to create the controllers to get the right contents and the views to display the content the client added with the CMS.

I've looked at Devise, and it looks great, but a gem feels somewhat to complicated for my needs. I'd rather have just that folder stored on our local network, so we can drop it in the project and install it.

The question is: Where can I put a single folder with the controllers, helpers, models, views, and a file with functions to setup migrations routes?

My guess was the lib folder, but I'm not sure how to implement all the stuff in the project it's in. I've been looking for design patterns, but I'm not sure where to search for.

What I need is the reusability of a gem, but stored on my local network in a single folder.

Hope someone can point me in a right direction.

Thanks


Solution

  • As Shreyas Satish mentioned I should use Engines for this.

    After a little searching I found this great tutorial:

    http://www.builtfromsource.com/2010/12/13/mountable-engines-in-rails-3-1-beta-getting-started/

    Hope it can help someone with the same question..