Question

I have to built a social networking site on Ruby on Rails. The features in the site may change from time to time; so we will need to add/remove features with ease. Moreover, we may be building another social networking site. Due to these reasons, we are thinking to build a basic framework for social networking sites in RoR with the feature to install or uninstall extensions to the framework.

I worked previously in Joomla! CMS and its architecture for adding/removing extensions is kind of what I am looking at. In a Joomla! installation there is usually an admin side from which you can add/remove/customize extensions.

I am new to RoR and finding it little difficult to decide how to do this. Any help will be appreciated.

Was it helpful?

Solution

UPDATE 2015: this was answered in 2009 a lot has changed

Plug-ins have been superseded by Gems and Engines For all the information you need on Engines: http://guides.rubyonrails.org/engines.html

Engines are a fantastic way of building encapsulated and reusable code for your rails apps.

Original Answer for Reference

On the development side Rails Engines and/or plugins is probably what you are looking for.

Rails Engines are small subsets of an application that can be dropped into any of your Rails applications and handle common parts of the application from scratch.

Say for example your social networking application has a wiki, blog, chatroom etc. You would more than likely want to create a wiki engine, blog engine and chatroom engine.

Engines allows you to re-use such functionality within different applications so you do not have to repeat yourself.

Take a look at: http://rails-engines.org/

Some support for ‘engine’ plugins has been merged into the Rails core codebase in Rails 2.3.

I would also recommend taking a look at some public projects say on github and see how people have used engines.

Take a look at some engines:

Other useful links for reading

In functionality terms you could still have an admin area that could activate certain features ie. your blog or wiki by allowing users access to such areas with a permissions/roles system.

If you want to build a CMS which supports some kind of extensions like in Wordpress or Joomla then you will have to either build it and provide guidlines or at least look into how you would upload/install Engines/Plugins from a user perspective.

Not sure on the security implications of this

Redmine has put this kind of functionality into their awesome application. You may want to dig around the source code for tips and clues

Finally Adva_CMS has basically adopted this approach and have created a number of Engines for their CMS application

HTH

OTHER TIPS

Engines are still a pretty solid way to go, the new location to get info on those is located here: http://guides.rubyonrails.org/engines.html

But what you need is really more application specific. A lot of applications develop these things organically over time. They start out by hand crafting a few of these and then they re-factor them periodically until they find patterns that align with software design patterns and then they develop a plugin framework.

Are you going to expose your interface to end users? To third party developers? What parts of the application are controlled by these plugins? Is it just the presentation tier? Does it affect the data model? Consider the fact that when you publish any kind of external interface, you're developing contracts that you need to honor.

You might check out these design patterns: http://en.wikipedia.org/wiki/Software_design_pattern. They will help you figure out how to manage your development process. If you're just working on plugins for internal use, then what's the real purpose of them? What makes them different than modules?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top