Sha256: 20663d4af31b0d164bc891c083fe95d00784a350ea1e127dd48eb884dffd32c6

Contents?: true

Size: 325 Bytes

Versions: 3

Compression:

Stored size: 325 Bytes

Contents

class ModifyUpdatedAt < ActiveRecord::Migration
  def up
    NobelPrizeWinner.all.each_with_index do |npw, i|
      npw.update_attribute(:updated_at, npw.updated_at.advance(seconds: i))
    end
  end

  def down
    NobelPrizeWinner.all.each do |npw|
      npw.update_attribute(:updated_at, npw.created_at)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
with_filters-0.1.2 spec/dummy/db/migrate/20120209051208_modify_updated_at.rb
with_filters-0.1.1 spec/dummy/db/migrate/20120209051208_modify_updated_at.rb
with_filters-0.1.0 spec/dummy/db/migrate/20120209051208_modify_updated_at.rb