David Louis Edelman David Louis Edelman

Dave on Ruby on Rails

Imagine you’ve never played the game of football (the American version) before. You’ve never even seen a football game, and you have no idea what the rules are. But somebody tells you it’s way hella cool, and you’ve got the build for it, why don’t you come on down and join the team.

So you suit up and get on the field, but you still don’t have the foggiest idea what’s going on. Sometimes people are running with the ball, sometimes they’re throwing the ball, sometimes they’re kicking it or just pushing other players around and jumping on them for seemingly no reason. You try to ask the other players what’s going on, and they’re perfectly willing to help you — but all you can catch is a few seconds of their time between plays when they’re out of breath.

Ruby on Rails logoThat’s kind of how I feel trying to learn Ruby on Rails.

What the hell is Ruby on Rails? For all you non-technical people out there, it’s a programming environment that’s supposed to make development super, mega easy.

Those with a more technical bent have probably already heard about Ruby on Rails. But for those who haven’t, it’s an open-source web framework where you can use the popular Ruby language to build robust applications using the Model-View-Control pattern in an astonishingly few lines of code.

How easy is it? Well, once you’ve got it installed properly, you literally type “rails book” and then “ruby script/generate scaffold chapter.” In the space of seconds, RoR generates all of the files you need for a project called “book” composed of multiple “chapters.”

From there on out, it’s amazingly simple too. You can describe the data model with two basic statements:

class Book < ActiveRecord::Base
has_many :chapters
end

class Chapter < ActiveRecord::Base
belongs_to :book
end

RoR takes care of generating all of the HTML files needed to make it work on the fly. Within five minutes, you can have an application that will let you seamlessly add, edit, and delete chapters to a book. No more mucking around with granular SQL statements and spending hours debugging.

The problem is, you’ve got to get it installed properly.

And getting Ruby on Rails installed properly is a bitch. It’s taken me days, and I’m still not sure I’ve got it done right. Luckily, you don’t need a web server to serve up the application because RoR comes with a built-in lightweight web server called Webrick. Oh, but wait, Webrick isn’t powerful enough for a production server, so we need Apache. With the FastCGI module installed and configured for Ruby files. Oh, but wait, nobody uses FastCGI to do this anymore, everyone’s using something called Mongrel these days…

Compound this with the fact that every flavor of *nix has its own special tweaks and mods that you need to do to the config files to get things working. I’ve seen a million pages now with some variation of the following: “Never mind why for the moment, if you’re using CentOS with MySQL and Apache, you need to CHMOD 755 on this particular folder and add this line to the httpd.conf file…”

Think you can escape these problems on Windows? Good ol’ clunky, kludgy Windows that makes everything simple? Wrong. There’s a package out there called InstantRails that you can supposedly just unzip on your computer and have the whole thing running in minutes. Except my spankin’ new Windows Vista machine at the office won’t unzip it, because Vista currently has a problem unzipping zip archives with tens of thousands of files in them. (Update 3/14/07: Problem solved. Downloaded and installed free, open-source 7-Zip instead, which took care of the upzipping in 2 minutes 30 seconds.)

Yes, Ruby on Rails is cutting-edge web development, and I’m not used to sitting out on the cutting edge. RoR has literally only been out for 2 1/2 years. And that means that it’s poorly documented, with most of the available information coming from uber-geeks who’ve figured something out after much trial-and-error and written a hasty post about it on a blog or forum.

Remember what the World Wide Web was like in, say, 1994? Everyone was fantastically excited about it, but nobody was quite sure what it could do. You would see pages that were nothing but prettified bulleted lists alongside pages of enormous graphics taken straight out of a glossy four-color catalog.

There’s a reason why they call it the cutting edge or the bleeding edge. It’s because you feel like you’ve been cut and you’re bleeding. Kind of like you feel after playing football.

Comments RSS Feed

  1. Brian on March 12, 2007 at 1:17 pm  Chain link

    Except my spankin’ new Windows Vista machine at the office won’t unzip it, because Vista currently has a problem unzipping zip archives with tens of thousands of files in them.

    gnu zip compiled for win32 – is that an option?

  2. David Louis Edelman on March 12, 2007 at 1:55 pm  Chain link

    I don’t think it’s a problem with the unzipping process per se — the best I can glean is that it has something to do with some flag that Vista puts on files downloaded from the Internet as a half-assed security measure. I suppose I should try a different unzipping package though.

  3. tanel on March 13, 2007 at 12:12 am  Chain link

    usually on windows machines we install rails like this:

    1) download ruby one click installer and run it
    2) from command line (I hope you what it is?) run

    gem install rails

    I have had no problems with rails installation anyway.

    A unix (linux, mac) machine is always preferred for development. You see, rails is for web applications. And web applications like to run on Unix, not Windows. Windows is for viruses, games, porn and generally for the clueless users, not for development. (ha ha ha)

  4. David Louis Edelman on March 13, 2007 at 5:41 am  Chain link

    Tanel: Not sure I totally agree with your assessment of Windows… but we’re doing RoR on a Linux machine for production purposes. CentOS, actually. I was just hoping to have the RoR installation on my WinVista machine so I could play around with it.

  5. Brian on March 13, 2007 at 11:17 pm  Chain link

    I gotta tell you – you inspired me to at least install Ruby on Rails. Will I mount the curve and actually DO anything with it? We’ll see. But there are a number of things at the day job that would be enhanced by being able to fool around with stuff like this.

    Start to finish install time – oh about 90 minutes, excluding time spent downloading Xcode from Apple (my OS cd is at work).

    I’d like to report there were problems … but there weren’t. I ain’t gloating, just reporting.

    briandunbar_natasha-2_~:ruby -v
    ruby 1.8.2 (2004-12-25) [universal-darwin8.0]

  6. Brian on March 13, 2007 at 11:18 pm  Chain link

    Side note – development is best done where you are comfortable. The tools you use for unix you can get for win32. But that’s only the opinion of a system admin not a developer so take that for what it’s worth.

  7. David Louis Edelman on March 14, 2007 at 7:27 am  Chain link

    I’d like to report there were problems … but there weren’t. I ain’t gloating, just reporting.

    Well, I will say in my defense that I’m not used to spending lots of time on the Linux command line. When I can’t remember the exact switches I need to un-tar a file and I have to edit files in vi, it’s gonna take me a little longer.

    Keep me posted on how you’re liking Ruby on Rails.

  8. Brian on March 14, 2007 at 12:33 pm  Chain link

    Hey – I can’t keep all that stuff in my head either. Google is my friend.

  9. Steve on April 7, 2007 at 3:37 am  Chain link

    I too had trouble with installation of InstantRails on Windows Vista, but I would usually tend to try a manual install of everything first anyway which I am in the process of doing right now.

    It has taken me less than 5 minutes to run the .exe install for ruby and “gem install rails” command to install rails.
    I have no idea where I go from here yet but I hope it is not as difficult as you seem to think.
    “Windows is for clueless users” is a bit harsh, I am installing on Vista purely for convenience….. I may later install on a virtual machine or a seperate box running linux maybe.

    Hoping that all the hype about RoR isn’t just that but after watching the videos on the Rails website, I am instantly impressed.
    Will see where it takes me next!

    Your American football analogy is a good one, it is exactly how I feel…. after coding with PHP for a few years, the web programming world almost “commands” me to at least give RoR a try but admittedly it all seems alien to me.

  10. David Louis Edelman on April 7, 2007 at 10:04 am  Chain link

    Thanks for that, Steve. I have in fact gotten InstantRails working on my work Vista machine, and I’ve got it running (with the Mephisto CMS software too!) on a hosted Linux account too. Right now it’s Mephisto and Liquid that are kicking my ass, along with Mongrel Clusters and Pound. :-)

  11. Ming Jack Po on May 18, 2007 at 11:23 am  Chain link

    Hey David,

    did you have to do anything special to get instantrails to run on your vista box? Is there anything I should watch out for (horrendously slow speeds or something?)

    Thanks in advance!

  12. David Louis Edelman on May 18, 2007 at 1:10 pm  Chain link

    Ming: No, it seems like the big hurdle for Vista was just unzipping that horrendously huge file for InstantRails. Once you’ve done that, you’re 95% of the way there — no install programs or anything.

    Of course, my understanding is that InstantRails on Vista is really only good for development… If you want to actually run production applications, you’re better off installing the components one by one.

  13. Michael Collins on December 12, 2008 at 2:09 am  Chain link

    Hi David, I couldn’t agree more. Yet, I’ve been a programmer of all sorts for years, mostly embedded/real-time stuff – various assemblers, C, Ada, C++, C# as well as those I had to learn at uni. I find web-stuff counter intuitive somehow, and was hoping for some miracle with RoR, yet just getting something going is enough to put most people off. With instantRails, Vista won’t let MySQL start – am just about to try instantRails on XP on the Mac, but first it wants to install a load of windows updates…reboot, then one more update, start instantRails unzipping, then switch off IIS, then try the instantRails, which by now is unzipped. Advise firewall that Apache is a good thing and to let it be, then all seems to be working – but, hey, I did something and instantRails disappears…dbl-clicking on it does nothing…ah, well, reboot and it works again. Ok, now where’s the IDE? Is this thing for real in 2008? How does anybody get started in this confounding thing, please..? {:-|

  14. Mja on April 10, 2011 at 6:53 am  Chain link

    @ Brian – LINUX/UNIX NGINGNGNX/Sucix/MyDIX is opposite to windows for …what? blowjobbing around in a commandprompt?. What webdeveloper on this side of 2000 would use anything that doesn’t have a GDI? Why are opensource people always so lazy they don’t throw out applications and systems that comes with a proper editor? ‘A webserver wan’t to run on linux?! What do you mean? A you mean if your use php (a wannabe .net and javas architecture, without proper possibility to make an n-tier app?) Most php developers are a product of bad coding habbits, examplified by junking everything into one page, becasue they think they compete with the old asp. Some of you OpenMouth developer needs to get out of your dark basement and find out that the world is a different place nowadays….
    Besides that I’m so tired of this os war. I hate windows myself, but i have nothing bad to say about visual studio i ex, since its so well performing, and easy to use for developing, no matter i want to play textditor nerd or edit things more abstract. It’s like when apple people started to bitch over windoes user ‘uhuh Bill gates is just running you over and stealing your money – apple is freee!’ (yeah right why don’t we hear anything about that now? Because the apple seems to have turned into the most Christian mindcontrolling crap company on earth. Thank you Apple! – For letting us crack all your shit back in the c64/amiga days and disturbing your life.
    Anyway – a coding language that needs to use a commandpropmt 24/7 should start bicthing against other langauges, OR claim that it’s userfriendly.

Add a Comment

I don't censor comments; please don't make me have to start. You can use common HTML tags, such as <b>, <i>, <a>, and <blockquote>. Comments with more than one hyperlink automatically go into the moderation queue. Your information will not be rented or sold, ever.