Ruby On Rails Rocks

October 14, 2007 at 11:29 pm | Posted in Uncategorized | 11 Comments

Yes, you’ve read right, this post is about Ruby on Rails, not about KDevelop 🙂 (at least not directly).

Friday I started to look into Ruby, because a) its currently hype and I wanted to look into Ruby on Rails for some idea how other web frameworks (besides J2EE/Spring) look/work/feel like. Well, the language itself was done in a good half of a day, not much new stuff if you’re used to a scripting language like python or perl already (probably a bit more for perl-enthusiasts). A few nice things like their iterators and leaving out parenthesis (though that gets confusing sometimes) or the full object-orientation – where python still has a procedural way of working. There are also 2 downsides I noticed, which are non-native thread implementation (hooray for cross-platform, but not so nice if you want to use 1 ruby app with multiple cores) and the IMHO more serious problem of dealing with plain byte-strings. This means either using 8-bit encodings for your strings or doing some workaround like using jcode and having to use special new functions like jlength instead of length. This is something I really dislike, we’re in 2007 after all.

Anyway, yesterday I started with a small nice-to-read Rails tutorial and got some of the basics straight. Also nothing really fancy here, except that its a lot less configuration compared to J2EE/Spring and also a lot more pre-generated-already-working code. So I have to code less and can create more 🙂 It also turned out that Rails people like to write books and get money off of teaching other people Rails. I managed to borrow a Rails book for a few days from a colleague and worked through most of the example-app (simple ordering-system for books). The result is that I’m really amazed how this stuff works together and how easy it is to create new stuff based on what you’ve seen so far. Like adding a remove-item-from-shopping-cart button that uses AJAX, if available, based on the add-item-to-shopping-cart. Really cool stuff and I guess if I can I’ll see that I get a job where I can use RoR.

Last but not least I’ll try to get KDevelop into this post: I’m using it to work on my rails app. Even without any parsing-support it already helps finding your way around. You get the quick-open stuff (at least file-based) to quickly jump to the files you need, there’s support for running the rails server and opening a browser that points to your app. And for coding there’s kate with syntax-highlighting for ruby, rjs, rhtml and all other filetypes, even indentation works quite ok once you’re not using the C-indenter 🙂 The only thing that I didn’t manage to get working are a few actions that should allow to directly jump between model/view/controller and the integrated shell, but thats already reported on our mailinglist.


  1. I like Wt better: you develop websites using C++ (therefore you can use any C/C++ library you need), it mimics the Qt API, it uses the best AJAX library (Ext JS) and you can build your webapp as a standalone application which includes webserver or as a FastCGI module to use with Apache, LigHTTP or even Microsoft IIS.

  2. Rails comes with mulibyte for unicode:

    Ruby2 (coming this Xmas) has native thread and m17n for unicode and more (see 🙂

  3. there’s also backgroundrb that helps work around the thread thing:

  4. @Pau: Webdevelopment with C++? Can’t imagine how that works well, but you never know 🙂

    @patcito: Hmm, I couldn’t find a clear release plan, except for some blog posts that ruby 1.9.1 will be released this year around Christmas. Thats not quite 2.0 in my ruby-newbie eyes.

  5. For Rails multithreading doesn’t matter that much. Each rails app is single threaded so you can run multiple instances of it. The common setup is to have mongrel cluster running N mongrels (your ror apps) and to have a load balancer (software – apache, nginx or hardware) to serve requests using different mongrels.

    PS: you know where to find the Rails job, do you? 😉

  6. @adymo: Yes already saw that threading is not a problem for rails, I was speaking more about ruby for that 🙂

  7. @Apaku: Desktop development with C++? Can’t imagine how that works well either, then ?

    Seriously, what’s supposed to be so different about web UI development ?

  8. Hi Apaku,

    could you explain to me how you got indentation to work with Ruby files in Kate? If I press “Enter” after a “def hello” Kate doesn’t indent two more spaces but the cursor lands right under the “d” of “def”.


  9. I never said that works 🙂 It doesn’t auto-indent to the “next” level on a newline, but at least it auto-indents to the level on the previous line which makes indenting/un-indenting much easier.

  10. For ruby auto-indent on Kate, use the below:

    Edit ~/.kde/share/config/katefiletyperc
    Create the file if it doesn’t already exist
    Add the below to the file:

    Variables=kate: indent-mode varindent; var-indent-indent-after ^( )*(if|while|def|class|for|unless).*|\\{[^\\}]*$|else|elsif|rescue|do|begin; var-indent-indent; var-indent-unindent ^( )*(end|else|elsif|rescue)|^[^\\{]*\\}; var-indent-triggerchars }def; space-indent on; indent-width 2;

    (You can find this on

  11. Sorry – pressed Submit too soon…

    After creating/ editing the file as described above, follow the below steps:

    1. Start Kate
    2. Go to Settings > Configure Kate > Editor > Indentation
    3. Select “Variable Based Indenter” under “Indentation Mode”
    4. Open a Ruby file
    5. Type in “def hello” and press Enter
    => Enjoy auto-indents!!

Sorry, the comment form is closed at this time.

Blog at
Entries and comments feeds.

%d bloggers like this: