Validation assertion added to test_spec_on_rails
I’ve added a new assertion to test_spec_on_rails that enables verification that validates_presence_of is being called correctly on your ActiveRecord models. For example, say you have a model like this: class User < ActiveRecord::Base validates_presence_of :first_name, :last_name end You would typically test this validation by leaving a field blank, calling valid? … Continue reading
Why does tabbing skip certain form fields in OS X?
Isn’t it incredibly annoying how both Firefox and Safari skip select fields and check boxes while keyboard tabbing through a form? Fortunately, there is an incredibly simple solution. (The fact that this isn’t a default setting in OS X makes me wonder if the Apple people wrote that particular preference … Continue reading
Contra dancing
I went contra dancing with some friends last Friday. I’ve done English country dancing before, but never contra. It’s quite a workout, but really fun. Our friends were kind enough to post this video from the event:
Building arrays of similar objects in Ruby
I often find myself having to build arrays of similar objects in my tests. For example: def create_user :some_user end users = [create_user, create_user, create_user] It seems wasteful to repeat the same method call three times. One solution is to use the #times method to append to an array, like … Continue reading
How to filter model data before rendering in Streamlined
One question that seems to come up a lot on the Streamlined mailing list is how best to filter the records that are displayed in the list view using a certain set of conditions. There are several ways of doing this, but the simplest way is to use Rails’ built-in … Continue reading
Is Communism really dead?
I found Misreading the Tea Leaves by J.R. Nyquist to be pretty thought-provoking. Maybe you will too.
raleigh.rb has a podcast
Did you realize that Raleigh’s own Ruby Brigade now has a podcast? Yes ladies and gents, it’s true. I’ve been recording the last few meetups on my MacBook. The audio quality isn’t half bad. I hope to expand the podcast in the future with non-meetup content. For now, it can … Continue reading
Using named routes in Streamlined addition files
For you Streamlined users out there, here’s an easy way to include named routes in your Streamlined addition modules. Previously, you had to hard code the URLs like so: module OrderAdditions def name_link link_to user.name, “/users/show/#{user.id}” end end Order.class_eval do include OrderAdditions include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper end Streamlined.ui_for(Order) do list_columns … Continue reading
Bill Gates wants to annoy the whole world with Windows
Yes, it’s true. Bill Gates wants to annoy the whole world with Windows.