RubyOnRails

How To Start A Rails Edge App The Easy Way

There’s a lot of cool stuff pooring in about what’s new in Rails Edge (which will become Rails 2.3 and/or Rails 3). Most likely you can’t wait to get started with these new features, especially when you’re about to start a new project, which doesn’t have to be stable yet, but will be by the time 2.3⁄3.0 come out. This post shows you the way to create a new Rails app based on the most current Rails code, also called Edge Rails.

Zoek jij 'n uitdagende baan??

First off, sorry to all the English-reading people, but this post is intended for my Dutch audience. Even wat updates voor mijn Nederlandstalige publiek. Ik heb wat nieuwtjes voor jullie, dus lees snel verder! Allereerst wil ik even melden dat ik a.s. dinsdag (10 juni) te vinden zal zijn op RubyEnRails 2008. Dus, ben jij er ook, laat ’t me even weten! Laat even ‘n commentaartje achter, of nog beter: bel/sms me even dinsdag op 06-17103624, dan spreken we elkaar zeker!

Debian Etch: RMagick LoadError

If you’re on Debian Etch, you may encounter the following error libMagickWand.so.1: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/rmagick-2.3.0/lib/RMagick2.so This basically means that the libMagickWand.so.1 file cannot be found. However, it is available on your system. All you need to do to fix it, is tell your box to look in the right place for the file. To fix this issue once and for all, open up /etc/ld.

Rails Snippet: Caching expensive calls

In Rails, from time to time, you may encounter you have a method you call several times, but which returns always the same result. For example, have the following: class Person < ActiveRecord::Base has_many :articles def get_approved_articles self.articles.find(:all, :conditions => {:approved => true}, :order => 'approved_on DESC') end end A query is fired every time you call Person#get_approved_articles. To cache the result of the query during this request, just add a bit of magic

Flash not clearing after a request?

We all know “The Flash” to be a very useful tool in almost every application we write. What does “The Flash” actually do? The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed to the very next action and then cleared out. Well, that’s all nice, but what if you notice that your flash is not cleared, and is shown in one or more subsequent requests as well?

RailsConf Europe 2007!

Well, after a long trip, I arrived at my hotel yesterday in Berlin. Today I, and my mates from Kabisa, have joined RailsConf Europe 2007. I don’t think I’ll be giving a full, in-detail report of everything that happens, but I will let you know anything worth your (and my) time. If you happen to be in Berlin these days, feel free to drop me an e-mail at ariejan at ariejan.

Content_for, yield and making sure something gets displayed

You may have heard of a very nice Rails technique that used content_for and yield to stuff custom blocks of content into a layout. For example, in a view you could add a block like this: This goes into the sidebar when viewing this action! It doesn’t matter where you put it in the view, because, as you may notice, the content within the content_for block is not shown in the view.

Blueprint 0.5 Rails Plugin released

A few days ago BlueprintCSS 0.5 was released (read the Olav’s posts here). I’ve updated the plugin accordingly. The most important change is the use of 24 (!) instead of 14 columns. Installation and usage of the plugin have not changed. See my original announcement for more information.

BlueprintCSS Rails Generator

This plugin is no longer available. Blueprint nowadays ships with a very good ‘compress’ script that allows you to generate all kinds of nice BluePrint layouts. Having a plugin to just copy some files seems a bit excessive. I think that, if you’re a web developer, you’ve seen the BlueprintCSS framework. BlueprintCSS offers quite a bit of CSS code that allows you to quickly and easily build a grid-based layout, using pure CSS.

Super Simple Authentication Plugin and Generator

I hereby proudly announce my Super Simple Authentication plugin and generator. All right, what does it do? Sometimes you need to protect your actions and controllers, but you don’t want to go about installing restful_authentication or anything like that. Adding a simple password for certain actions would suffice. So, I wrote a little plugin that can generate some code for you that allows you to easily protect your app with a simple password.