Simple trick to use sql dump in rails
Friday, October 30th, 2009Fastest way to use sql dump when riding Ruby On Rails.
script/dbconsole < dumpname.sql
Fastest way to use sql dump when riding Ruby On Rails.
script/dbconsole < dumpname.sql
Define:
class Array
def every_nth(nr)
self.in_groups_of(nr).map(&:first)
end
def every_nth!(nr
self.replace(self.every_nth(nr))
end
end
and use:
>> (1..9).to_a.every_nth(3) => [1, 4, 7]