Tag Archives: Ruby

Rails 3 console and “no such file to load”

If you happen to load gems in your ~/.irbrc , make sure to add a gem dependency on them in your Rails apps’ Gemfile. For example, I just started using Awesome Print in IRB. However, when I ran rails console … Continue reading

Posted in Ruby Tagged , ,

Hashes and Frozen Keys

The hash class freezes keys that are strings: This can be a problem if you want to use those keys later on…more specifically, if you want to extract and edit those strings: Unfortunately, those strings will have to be duped … Continue reading

Posted in Coding Tagged ,

Sinatra and Passenger/mod_rails

If you want Apache to serve up a Sinatra app, your best bet is to use Passenger (AKA mod_rails). All your app needs is the usual Rackup config file (config.ru) in the app’s root directory, and the directory public/ . … Continue reading

Posted in Coding Tagged , , ,

Ruby in Etch

As some of you may know, Ruby and Debian’s ways of packaging software go together like Darwin and religious zealots…as in, they don’t. So how should you install Ruby when using Debian Stable? How do you stay up-to-date with new … Continue reading

Posted in Coding, GNU/Linux Tagged , ,

Default stegosaurses

Ever heard of Jonathan Viney’s active_record_defaults plugin? It’s fantastic. In a nutshell, it enables you to specify default values for model attributes. If an attribute isn’t set when initialising a new instance, the attribute’s set to whatever the default value … Continue reading

Posted in Coding, Ruby Tagged , , ,

Friends don’t let friends code without tests

But what if your friends don’t write tests? Or what if you’re just lazy? Well, if the latter applies, that’s your own damn fault. But if nobody around you tests their code, you’re probably not going to be motivated to … Continue reading

Posted in Coding Tagged , , ,

Testing…it’s what life’s all about

I just read a great call to action by John Nunemaker. He wants to see everyone writing tests for their code, and has decided to “post like a superhuman fiend until everyone is testing”. He’s on to something! With that … Continue reading

Posted in Coding Tagged , , ,

Rails Resources:   :as   vs   :controller

As you may or may not know, when configuring routes and resources in config/routes.rb , you can pass the :as or :controller options to map.resources . When I first read about these two options in the Rails Routing From The … Continue reading

Posted in Coding Tagged , ,

ModelSpeccer Released!

Yesterday I released my first open-source project. It’s called ModelSpeccer, and it generates RSpec specs on-the-fly for Rails model attributes. It started out as part of my housing rentals website, and eventually grew into a separate module. Once that happened, … Continue reading

Posted in Coding Tagged , ,