SitePoint Sponsor

User Tag List

Results 1 to 23 of 23
  1. #1
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 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?

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is tons of documentation, all the links to it are here:
    http://www.ruby-doc.org/

    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.
    Happy switcher to OS X running on a MacBook Pro.

    Zend Certified Engineer

  3. #3
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:

    http://pandora.rubyveil.com/pandora/...uction/Pandora

    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 (www.rubyonrails.com).

    An open source CMS done in Rails:

    http://dev.radiantcms.org/

    Online Rails api documentation:

    http://railsmanual.com/class/ActiveRecord::Base

    Tutorials:

    http://www.onlamp.com/pub/a/onlamp/2.../20/rails.html
    http://www.onlamp.com/pub/a/onlamp/2.../03/rails.html
    http://www.slash7.com/articles/2005/...arted-in-rails
    http://www.onlamp.com/pub/a/onlamp/2...ails_ajax.html
    http://www-128.ibm.com/developerwork...y/l-rubyrails/
    http://www.rails4days.pwp.blueyonder...Rails4Days.pdf
    http://manuals.rubyonrails.com/

    Online Ruby books:

    http://poignantguide.net/ruby/
    http://www.rubycentral.com/book/

    Ruby documentation:

    Core: http://corelib.rubyonrails.org/
    Stdlib: http://stdlib.rubyonrails.org/

    (but you can access these using the ri command)

    And, of course:

    http://www.sitepoint.com/forums/showthread.php?t=281181

  4. #4
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ruby is much better as a language
    Can opened. Worms everywhere...

    (though I agree)

  5. #5
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Fenrir2
    Ruby is much better as a language.
    Well, yeah, that's pretty much what you would expect in a forum named "Ruby", right?

    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?

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    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.

  7. #7
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by PixelLover
    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 http://pragprog.com/ they're starting work on the second edition of the book, which is available electronically.

    Other than that, the Rails API (http://api.rubyonrails.com/) 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

  9. #9
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, that's a coincidence, I ordered that exact same book this morning at Amazon. Thanks for the links!

  10. #10
    SitePoint Member Arto's Avatar
    Join Date
    Mar 2005
    Location
    Spain
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Quote Originally Posted by PixelLover
    Quote Originally Posted by Fenrir2
    Ruby is much better as a language.
    Well, yeah, that's pretty much what you would expect in a forum named "Ruby", right?
    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 great hackers should prove most liberating and entertaining reading.)

    Quote Originally Posted by PixelLover
    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.
    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:

    http://wiki.rubyonrails.com/rails/pa...ails+based+CMS
    http://railfrog.com/

    Quote Originally Posted by PixelLover
    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?
    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

  11. #11
    SitePoint Member
    Join Date
    Jun 2005
    Location
    Eastbourne, UK
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, check out Radiant - it's the new cms that has been developed to run the next iteration of the RoR website.

    http://radiantcms.org/

    (there is a blog post by Matt McCray that has a really good overview of the main points here http://www.mattmccray.com/archives/2...ants-radiance/)

  12. #12
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. Rails is very new.
    2. The current trend isn't towards CMS, but towards more "web 2.0" like things such as wikis.

  13. #13
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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...?

  14. #14
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by PixelLover
    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?

  15. #15
    SitePoint Guru 33degrees's Avatar
    Join Date
    May 2005
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by b0rdslide
    Also, check out Radiant - it's the new cms that has been developed to run the next iteration of the RoR website.

    http://radiantcms.org/

    (there is a blog post by Matt McCray that has a really good overview of the main points here http://www.mattmccray.com/archives/2...ants-radiance/)
    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.

  16. #16
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  17. #17
    Awesome Addict
    Join Date
    Mar 2004
    Location
    Toronto, Canada
    Posts
    326
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:

    http://www.example.com/page/about

    But what if I want

    http://www.example.com/about

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

  18. #18
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can change that. I think this will do the trick in routes.rb:

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

  19. #19
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by gregor002
    Instead? Could I muck around with routes.rb to produce that? Other ideas?
    Yeah, routes.rb is your best bet. Here's a sample from the CMS I built:
    Code:
    #maps pages and sections
    map.page ':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'

  20. #20
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Done.

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

    Quote Originally Posted by gregor002
    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:

    http://www.example.com/page/about

    But what if I want

    http://www.example.com/about

    Instead? Could I muck around with routes.rb to produce that? Other ideas?
    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

    [code]
    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 domain.com/one/two/what/stuff, 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.
    Ohai!

  21. #21
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, thanks so far. In the meantime, I've managed to get hold of the RoR bible aka "Agile Web Development with Rails". I got stuck a couple of times doing the tutorials but all in all I am pretty impressed with Ruby so far. Especially when you are coming from a Java background RoR makes you feel like Alice in Wonderland. I love Ruby's ability to map database tables to Objects etc. It makes the whole thing a whole lot more flexible.

    But here's my next question: Where can I get a decent Ruby on Rails cookbook with code examples for creating a content management system. I heard there's one in the making at O'Reilly's, but is it any good? What would be some other Ruby cookbooks on the market? Has anybody ever used one?

  22. #22
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by PixelLover
    But here's my next question: Where can I get a decent Ruby on Rails cookbook with code examples for creating a content management system. I heard there's one in the making at O'Reilly's, but is it any good? What would be some other Ruby cookbooks on the market? Has anybody ever used one?
    There really is no book like that yet. The main ones so far are the Agile book and Rails Recipes, which follows more of a cookbook formula (i.e. each chapter solves a specific problem, like "how do I use a rails app without a database?").

    If you want to just dive into some sample code though, you can take a look at Eribium, an open source Rails-based CMS that's in alpha stages.

  23. #23
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I think I'm gonna get the Rails Recipes one then... But why would anyone want to use Rails without a database lol... I think the way it handels databases is one of Rails core strengths!!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •