metautonomo.us

Confounding URL typists since 2007.

Monthly Archives: August 2011

The Cure for ActiveRecord Instantiation Anxiety: Valium

7 Comments

No, not the drug — the Ruby gem! Have you ever written code like this?

Model.where(:attribute => 'value').map(&:id).each do |model_id|
  # ...
end

I’m guessing you have, even if only as you were just getting started learning Rails/Ruby. It’s a bad idea.

Read the rest of this post

Filed under Blog
Aug 24, 2011