Archive for January, 2007
Hobo - And you thought Rails made life easy!
If you’ve seen anything of Ruby on Rails, you know it makes your life really easy with all its generators and plugins. Well, check out Hobo!
Hobo is a Rails plugin that adds tons of extra features that make your live even easier. Here’s a quote from their site:
Hobo is an Open-Source project that makes development [...]
Ruby: Sort an array of objects by an attribute
In this example I’ll show you how easy it is to sort an array of (the same kind of) objects by an attribute. Let’s say you have an array of User objects that have the attributes ‘name’ and ‘login_count’. First, find all users.
@users = User.find(:all)
Now, we have to sort this array by ‘name’. Since we [...]
Rails: Nested resource scaffold
In my previous post I told you about the resource scaffold. What you’ll be doing a lot is nesting these resources. Ingredients in recipes, comments on posts, options for products. You name it, you nest it!
Since Rails does not automatically nest resources for you, you should do this yourself. This is, with some minor tweaks, [...]
New in Rails: Resource Scaffold Generator
Oh boy! Rails 1.2 is all about resources. A product entry in your application is not just a rendered HTML page, but it “is” data. Rails 1.2 allows you to add a .xml extension to your url to retrieve the same product information in XML format!
Now, this all sounds hard. Two ways of rendering the [...]
Updates: Wordpress 2.1, Themes and Social
You can’t really see it, but Ariejan.net has been upgraded to Wordpress 2.1. I’ve been running 2.1 beta’s on a private server for some time now, so there weren’t any surprises during the upgrade.
I’ve also updated the theme to something more stylish and sober. Google Ads are less annoying now and merge nicely with the [...]
Why Ruby Rocks - Convince your fellow developers
I often hear questions from my Java and PHP oriented friends about what makes Ruby so great and easy to use. Until today I’ve shown them some of my Rails feats (AJAX Scaffold always amazes people). Now, I came across this 20 minute Ruby introduction. Starting with the basic “Hello World” item, this article show [...]
“Print this page” with Ruby on Rails
You have put a lot of effort into creating a sexy overview of whatever data your application stores and allow your users to manipulate that data through AJAX controls. But, some people just want to print their data.
How to go about that? Just printing the page with data is generally not a good idea because [...]
Rails: Group results by week (using group_by)
The Enumerable class in Rails contains a method named ‘group_by’. This method is pure magic for a developer’s point of view. I’ll give you a simple example that shows the power of group_by.
Let’s say you have a table ‘posts’ containing blog posts. Now, you normally show these chronologically a few at a time. Nothing special [...]
