hoodwink.d enhanced

Tue Sep 20

Ruby 1.8.3

Grab it while it’s hot.

Continuous integration in one line ;)

$ watch -n 600 rake
Matz has given the OK to start checking RubyGems into the Ruby trunk.

why the lucky stiff

DRY up object attribute change assertions

def assert_difference(object, method, difference=1) initial_value = object.send(method) yield assert_equal initial_value + difference, object.send(method) end def assert_no_difference(object, method, &block) assert_difference object, method, 0, &block end # ... def test_new_publication assert_difference(Publication, :count) do post :create, :publication => {...} # ... end end

Parking tickets

Tumblelogs everywhere

Chris Wanstrath kindly informed us of his new tumblelog, ones zeros majors and minors, by email last night. It seems great, and we’re looking forward to the release of his ozimodo tumblelogging engine.

Make all associated records of an AR object spring into existence as instance variables

# ex.: If Client belongs_to :firm and :project, # vivify @client = Client.find(params[:id]) # gives you @firm and @project associations. def vivify(object, macros = [:belongs_to]) all_associations = object.class.reflect_on_all_associations all_associations.each do |association| next unless macros.include? association.macro instance_variable_set "@#{association.name}", object.send(association.name) end end

Happy birthday to Scott’s son, Luke