Bc572b4652b1df3ea13619423acd6127

Can't we create first all records and then update is_default for all records?

Which is the faster process?

Gender.create([
  {:name => "Male", :is_default => true},
  {:name => "Female", :is_default => true}
]) if Gender.all.blank?

Refactorings

No refactoring yet !

D5145c421cd25af6fa577c15219add90

Nathan

March 19, 2010, March 19, 2010 13:20, permalink

No rating. Login to rate!

Refactoring isn't really meant to be about speed. If you're concerned about speed, Ruby on Rails probably isn't the best choice of technology to use. Refactoring is about simplicity, readability, scalability, etc. These attributes often come at the expense of execution speed, but the belief is that lower development time and cost make up for the additional cost of better hardware.

Your refactoring





Format Copy from initial code

or Cancel