By Myles Eftos

Ruby on Rails: The art of simplicity

By Myles Eftos

Hi there, my name is Myles Eftos and I’m your new Ruby on Rails blogger! I’ve been hacking rails for almost two years now, building a number of online apps, such as my time tracking system: 88 Miles. I am constantly pushing for that Rails-zen state, that harmonious balance between simply beautiful code and powerful functionality.

For those of you yet to be bitten by the Rails bug, it is as close to web development heaven you are going to get (Yes, I’m a bit of a Rails-fan boy – you have been warned). I have worked professionally on just about every web platform out there, and Rails is by far my favourite – things that take hours in PHP take minutes in Rails. The completely self-contained development environment, built in database migrations and deployment system means that you can get a Rails application out the door before some of the other guys have finished setting up their XML configuration files.

The soon-to-be released version 2.0 of Ruby on Rails will once again re-enforce the simplicity and power of the framework with a number of improvements that will make the lives of the humble web developer just that little bit easier. Serving up different versions of pages for different devices is a piece of cake with the new multi-view features, the security model has been improved and fancy new controller based exception handlers make ugly nested if statements a thing of the past.

I am going to try and present a good spread of topics throughout this blog with everything from beginner topics to more advanced bleeding edge techniques, but this ultimately will be driven by you. Please ask any questions you may have and I will do my best to answer them. I’m also lurking around the sitepoint forums waiting to pounce on any Ruby on Rails questions.

  • Excellent, I was just thinking about checking out what RoR was all about and if it’s just all hype. Will be v.keen on reading all about it. Hit me.

  • tuna

    So I’ve been mucking around with this RoR thing for a month or so (finally). Question is how does a Freelancer leverage it’s good points to convince client’s that it’s worth while as a development platform over say the standards like

    So I’ll be waiting for your ruby bits… bring it on..

  • madpilot

    Hi tuna,

    Yep, that is probably one of the biggest things a Rails developer will face at the moment.

    I’ll be preparing a post of that shortly :)

  • Welcome aboard Myles! I’d be interested in hearing if you use any coding strategies in order to not get burned by the shifting goal posts that is the Rails code base. I think this is one hurdle that the framework faces in getting widespread (read: corporate) adoption – that a feature that was only recently introduced gets deprecated a few months later.

    I’m also keen to see some code comparisons between different languages – you’re probably not that interested in continually highlighting the benefits of Ruby over PHP, ASP.NET, Java etc. But I always find posts like that fascinating, and the elegance of Ruby seems to win out.

    Another idea might be to look at what plugins are available and how to distil the good from the crud — once again, in order to not get burned by something in the framework getting deprecated and breaking the plugin. Can you tell that I’ve been scarred before? :-)

    My 2c.

  • Lisa Herrod

    You know, I have this theory that ROR is one of the Server Side languages that fits really well with the multidisciplinary approach to user centred design and improved user experience. I’ve been talking to some of the Sydney Ruby crew and I’m convinced there’s lots of positive stuff we can do in that area.

    I’m really looking forward to reading your upcoming posts Myles.

    Welcome ;)

  • Erinc

    Welcome, this blog will be more enjoyable with you.

  • Your comment “things that take hours in PHP take minutes in Rails” is invalid for the simple reason that PHP is a language whereas Rails is a framework built around the Ruby language. Either you compare the Ruby language with the PHP language, or you compare the Rails framework with a PHP framework.

    I have been writing frameworks in various languages for over 30 years, and I’m afraid that Rails does not impress me one little bit. This “convention over configuration” hype is all phooey, mainly because I don’t like those restrictive conventions. My latest framework does not have those silly conventions, nor does it have any XML configuration files. And as for Active Record, I’m afraid that is so primitive when compared with the power of a Data Dictionary.

    And when it comes to bragging I can generate working scripts with my framework faster than you can with yours, even though it was written in PHP.

  • madpilot

    Hi Tony,

    You are completely correct about the Rails/framework vs. PHP/language argument – and there are some great frameworks for PHP out there. However many of the developers out there still “roll their own”, so from there perspective there are comparable.

    And look, I’m not saying that Rails is for everyone or every situation – however for a majority of the sites I’ve done using rails, the framework has really helped me to do what I want to do – I find that many of the other frameworks out there try to be TOO generic. In my opinion, the best frameworks do one thing well. Rails does database-driven web site development well. If you don’t like, then fine. Don’t use it :)

    Horses for courses.

  • Quinton

    Would u just stop comparing Rails to PHP… its not fair. Of course Rails would win that one. Its a framework on top of Ruby but PHP is just PHP

    You dont hear about PHPers comparing Symfony to Ruby, do u?

    Compare Rails to Zend Framework or Symfony or CakePHP or whateva

  • jobr700

    Hi Myles!
    I look forward to read more posts from you.
    Will you also look at usage of Rails or Rails-like technology on other platforms than Ruby? For example Rails on JRuby or Rails on .NET (don’t know if it works yet, and I’m mostly interested in seeing Rails on IronRuby, if that will be possible).

  • malikyte

    I’m a PHP user through and through – but some of you have to realize that beginner web developers looking for a dynamic language see RoR, or PHP. They don’t hear about PHP’s frameworks all that often when just starting out. In that regard, the comparison does warrant some merit. I *think* that is what he was getting at. He already has a steep road to cross with so many more PHP developers lurking around reading the blog than Ruby folk, cut him some slack. It’ll be good for us to get some diversity. Welcome, Myles! :)

  • AnandC

    Welcome aboard Myles! Nice to see a ROR blogger on SitePoint. I already noticed that the religious debate has begun. I have been using PHP for about three years and moved over to Rais at the start of 2007. I do admit that using a solid framework makes development much more pleasurable.

    The main reason I moved over was because I was fed up with the slow pace of development of the Zend framework. Though I still think the Code Igniter framework for PHP rocks, but lacks some features I think should really belong in a framework.

    I do have to agree with you that Rails has a great organization structure and a very nice way to do things. And all the newbies will learn to love Active Record. My team and I have deployed two mid sized rails apps and one small app since the start of the year.

    Now, I do have to be honest here and say that it is true that development time with Rails is cut by 20-30% as compared to raw PHP (without a framework) or raw Python. But the dirty underbelly of Rails is that the 20-30% savings will eventually be spent on performance tuning and DBA tasks since Ruby is slow. The “myth” of ruby scalability is not a myth, but in fact very true (just ask Twitter). I have seen it first hand. So that mundace stuff that Rails helps you avoid in the beginning will eventually come back to get you.

    With all that said, I’m still very much on the Rails band wagon. I still love the elegance of the framework even though I’m still trying to get used to the Ruby syntax. And I absolutely love the plugin system. Can you say no more PEAR nightmares!!! And the built in getters and setters for AJAX components is a nice touch. Now I’m just hoping that Myles will help me get through all these performance issues!! ;)

  • mwmitchell

    Welcome! I look forward to checking out more posts!

    I’ve happily converted to Ruby and RoR. And believe me, it took a long time. I fought it, because I can’t stand trends. I’ve bent PHP in so many ways! But one day I was like, what the heck? I’m going to try this RoR thing out.

    I was using PHP for 6 years. Great fun, but I was constantly trying to see how I could make my code better. In-fact, I was trying too hard, and instead of making my applications better (for the end-user) it was all about the code that only I and other developers saw.

    You know when you have what seems like a really painful, sad breakup with a special someone? And it seems like the end of the world? “How can I go on without them?!” And then, months (years?) later you realize the breakup was the best thing that ever happened, because really… you weren’t even all that happy. Actually… you were miserable. I’m not miserable anymore.

    Or say you have an itch to go fishing… Do you want to go full-on, get dirty out in the sticks and twigs like a real man? You’d clean the fish yourself too! Or do you want to get out with a trained guide… on a nice boat, staying clean (no bug bites), popping some cold ones, snacking here and there, and then have someone else clean the fish for you? I’m going with the guide.

    Rails guides me in creating the *application*. Like I’m the conductor of a great orchestra. I don’t need to worry about how all of the instruments work, how to keep them maintained etc.. I just know that it sounds good, people love it and I’m having a great time. I never found that with PHP. It was more like I was trying my hardest as a dirty rock band leader.. screaming at a hung-over drummer, pleading with an arrogant guitar player and overall sounding like well… really bad.

    Not to start a flame way or anything (and of course Tony M. wasn’t either). It’s just that I’m at state high enthusiasm in regard to Ruby and RoR right now. They’ve brought the fun back.

  • madpilot

    That is the best analogy I have ever heard. Brilliant!

  • Anonymous

    hi im new to rails and im doing testing
    im using assert_tag :tag=>”div”
    but this is giving me the error
    1) Error:
    RuntimeError: expected > (got “.length; i++) {tttntttt//if the element is selected nttttif (elementList[i].id =={ntttttselected.className = selectedCssName;ntttt}nttttelse{ //if the element is unselectedntttttelementList[i].className = unselectedCssName;ntttt}nttt}ntt}ntt” for

  • Anonymous

    Hey Myles,

    Glad to hear you like rails so much.
    I’ve never really used rails. I checked the videos and read about it though. Symfony however has always been my preferred framework.

    I blog about Symfony and other stuff at, some of the older posts give a nice indication of the possibilities of Symfony.

    Maybe it would be nice to combine our knowledge and write a comparison between the two.


  • Glad to see you are liking Rails.
    Currently I am using Symfony which has been a very pleasant experience.
    My knowledge about Rails is quite limited. I never dived in, but only read tutorials and viewed screencasts.

    I also blog on the Symfony framework on my blog at

    Maybe it would be nice to combine some knowledge and write a comparison posts between Rails and Symfony together.


  • Ronnie

    Wherever I read about RoR I also read constant, pathetic and very annoying PHP-bashing. Hey guys would you mind stopping the hype and writing some useful app that people use instead of spitting sentences all over?

    “things that take hours in PHP take minutes in Rails”

    Do you realise how pathetic and misleading is this sentence?
    Wake up RoR’s year was 2006. Time to stop the hype and show something.

  • Craig

    In my opinion, most people that oppose RoR usually haven’t taken a close enough look at what the capabilities, benefits and advantages are.

    They’ve also invested many years into their current way of doing things; whether it be PHP or Java or whatever. For these defensive individuals change would be investing even more effort into something completely different. Not always fun or very productive.

    If you’ve been using PHP or Java to build web applications and you consider yourself a “rock star”, then keep doing what your doing. By now you may have created your own framework and libraries and you can get the job done quickly and efficiently.

    If you are still fairly new to web application development, you should definitely invest some time doing some of the many great tutorials on the web and see how fun web development can be.

    To quote our great friend Shreik…
    “Change is good Donkey!”

  • Well, ROR should not be underestimated, some tools such as calipso and migrations are far superior to other frameworks.

    However if you look at the total package, I feel Symfony is a better framework than RoR. Maybe a year ago I would have made a different choice. But as far as i can see Symfony is nicer than RoR.

    RoR deserves a great deal of credit though, it innovated so many aspects of web-development.

    Choosing a framework is a bit of a gamble, but my money is on Symfony :)

  • Mandrake

    All the media and web development agencies in UK are using PHP and/or .NET. I’ve seen a big agency getting into trouble and failing to deliver because of Ruby.

    If I’m not wrong, Ruby and Perl lost the web race years ago, and they should not be taken seriously or in consideration when developing medium/large websites (specially eCommerce sites). I doubt Ruby will ever be adopted by the LAMP family, it just wasn’t created for the web.

    Yahoo! choose PHP/Symfony over other Ruby/RoR and other languages and frameworks. That tells you the rest of the story :)

    On the other hand, RoR is fun and easy to use, my little brother loves it!

  • Looks like I posted twice :S thought the first one failed.

  • Mandrake:

    I prefer ColdFusion over RoR but I would still have to say you are “wrong”. In my opinion, PHP is clearly the worst choice of the major development platforms and .net is a close second. Just because PHP is used my some large organizations doesn’t mean that it makes good business sense.

    Ease of development, ease of maintenance, power, scaleabillity, stability, security – PHP is relatively weak in all areas.

Get the latest in Front-end, once a week, for free.