Creating a CMS using Ruby?

Hello there,

I want to create a content management system as my final year university project and I’m currently considering doing it in Ruby. Can anybody advise me as to what would be the benefits of using Ruby instead of PHP (which seems like the current industry standard to me). The only thing I don’t like about Ruby is the documentation and availability of literature on the subject. If I want to create a CMS using PHP and MySQL there are dozens of books to choose from, but how about Ruby? Where can I find decent information on how to create a CMS using Ruby?

There is tons of documentation, all the links to it are here:

For rails, just go to the rails website and there is a complete API documentation. But it doesn’t sound like you’ll be using rails, which would probably be better for a uni project.

Ruby is much better as a language. It supports many “advanced” things like call/cc, metaprogramming, lexical closures. But PHP, on the other hand, is focused on web development, and is available on many webhosts.

There are no “create your own CMS” tutorials for Ruby (while there are lots of these for PHP).

Maybe this for inspiration:

It’s written in Ruby (without Rails).

But if you want to use Rails, things are much easier. You can find a lot of information on Rails’ website (

An open source CMS done in Rails:

Online Rails api documentation:


Online Ruby books:

Ruby documentation:


(but you can access these using the ri command)

And, of course:

Ruby is much better as a language

Can opened. Worms everywhere…:wink:

(though I agree)

Well, yeah, that’s pretty much what you would expect in a forum named “Ruby”, right? :rofl:

But I also think that Ruby on Rails has some key advantages over PHP and especially the Java framework. I especially like the idea of mapping tables and entire databases to classes/objects. This should make things a hell of a lot easier (if it really works!). I have spent the last couple of months learning Java, JSP, and JSEE (a module at university) and I can safely say that Java SUCKS when it comes to web development. So I am looking for alternatives.

Has anybody heard of any more content management systems that were developed in Ruby on Rails? I’ve only seen one so far it hasn’t convinced me. How come there aren’t more? RoR seems to be the kind of design framework that web developers have always dreamt of, so how come there are so little CMSs out there? Any particular reasons?:shifty:

I have a mostly-built Rails CMS that I worked on for about 2 weeks. I got most of the features I wanted from it but I haven’t had any time to clean it up or do anything near a proper release for it.

I say do the system in Rails. It will be lots of fun and you’d be surprised at how fast you’ll have a working prototype.

Hey, that’s great news for me! I assume you have developed a CMS in another language before? 2 weeks is pretty fast… I have never made any CMS before, so this would be my first time. Can you recommend any book or resources that you used while developing your app? Thanks a bunch.

I can’t recommend “Agile Web Development with Rails” enough. If you go to they’re starting work on the second edition of the book, which is available electronically.

Other than that, the Rails API ( will be your best friend.

I will warn you though: I’ve been playing with rails on and off for almost a year now, and I built most of the CMS about 2 months ago. Things might not go as quickly for you, but it should still be nice to develop in :slight_smile:

Wow, that’s a coincidence, I ordered that exact same book this morning at Amazon. Thanks for the links!

Well, yeah, that’s pretty much what you would expect in a forum named “Ruby”, right? :rofl:[/QUOTE]
While better may be a subjective term, it’s certainly an objective fact that (as Fenrir remarked) Ruby provides abstractions that make it a more powerful language than PHP. Programming languages are not created equal, and Ruby is way further up the curve towards Lisp than PHP. This is as it should be, since we’re comparing apples and oranges.

(BTW, for anyone who has been forced to endure a Java indocrination at university, Paul Graham’s essays on the expressive power of various programming languages and [url=]great hackers should prove most liberating and entertaining reading.)

I haven’t really been keeping tabs, but I’m pretty sure there have been multiple open-source Rails CMS projects started over the past year or so. Check out these links for pointers:

Well, I suspect one reason may be that at the moment, Rails-related work is in very high demand and is lucrative enough that while many people (including me) are certainly creating proprietary CMS systems with Rails, there isn’t necessarily enough interest and free time to work on open-source projects for the “greater good”.

Personally, I’ve often entertained the notion of creating an improved Drupal clone in Rails, but as the 48-hour day hasn’t been invented yet, there just hasn’t been time :wink:

Also, check out Radiant - it’s the new cms that has been developed to run the next iteration of the RoR website.

(there is a blog post by Matt McCray that has a really good overview of the main points here

  1. Rails is very new.
  2. The current trend isn’t towards CMS, but towards more “web 2.0” like things such as wikis.

Ok, thanks for the links and everything. But has any of you ever come across a Ruby cookbook or something that provides some code examples on how to create a CMS in Ruby…?

You have to realize that “CMS” is a very broad term, and that the approach you take is going to be almost completely dependent on the type of content you’re managing. Care to explain your goals a little?

I’ve taken a look at the radiant project, and it seems quite promising, but it’s complex enough that it’s hard to wrap your head around without documentation. One to keep an eye on, though.

I don’t know how much you already know about Rails, but I think it will be obvious how to make a CMS once you’ve done 1 little (exercise) application. You just create a page model, possible acts_as_tree, and you assign text and child-pages to parent-pages. Then you create a ui (forms to create new pages, display page) and a user management system and there you have a simple CMS.

Not trying to hijack the thread but I have a question about developing a CMS with Rails and the concept of “pages”. From what I’ve been thinking, I’d have a Page model and a Page controller that would end up producing something like:

But what if I want

Instead? Could I muck around with routes.rb to produce that? Other ideas?

Yes, you can change that. I think this will do the trick in routes.rb:

map.connect ':page', :controller => 'blog', :action => 'show'

Yeah, routes.rb is your best bet. Here’s a sample from the CMS I built:

#maps pages and sections ':section/:page_url',
		:controller => 'page',
		:action => 'show_page'

#if it's the section only in the URL,
#forward to the index page for that section		
map.section ':section',
		:controller => 'page',
		:action => 'show_page',
		:page_url => 'index'

CMS is a vague term. The time to code one entirely depends on the feature set you require. I could code a CMS in 20 minutes (about) with rails. Create a Category model and have it act_as_tree, create a Page scaffold. Tweak it a bit. Add a catch all route using *url and map it to a show controller. Add a find_by_url method (or whatever the corrent OO name for this kind of function is) to my Page model. Code my show controller which simply takes the URL param from the route, passes it to find_by_url and displays the page. If there is no page, display an error page.


Of course, I don’t think this kind of CMS would be of any use with such little features.

I’m not sure exactly what you are asking, but you might be interested in the catch all routes.

I believe (off the top of my head, so I wouldn’t trust me) that it’s

map.catch_all  '*url', :controller => 'foo', :action => 'bar'

and then you can use params[:url] in your bar action in the foo controller., so if you pass, your params[:url] will be one/two/what/stuff and you can do whatever with it. You can also have 'whatever/*url'.

Of course, I might be off by a bit (or a lot), but two places to check more about this are the routes unit tests and radiant's source code.