Sha256: ba440610cfda1e54f7ae7a83335eedb903f030a04a6a8b830c4326dc3582ad86

Contents?: true

Size: 342 Bytes

Versions: 3

Compression:

Stored size: 342 Bytes

Contents

class ChangeCreatedAt < ActiveRecord::Migration
  def up
    day = 1
    NobelPrizeWinner.all.in_groups(3, false) do |group|
      seconds = 1
      group.each do |npw|
        npw.update_attribute(:created_at, "201201#{'%02i' % day}1201#{'%02i' % seconds}")
        seconds += 1
      end

      day += 1
    end
  end

  def down
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
with_filters-0.1.2 spec/dummy/db/migrate/20120210163052_change_created_at.rb
with_filters-0.1.1 spec/dummy/db/migrate/20120210163052_change_created_at.rb
with_filters-0.1.0 spec/dummy/db/migrate/20120210163052_change_created_at.rb