From 6a9f63109002bcc582d370437f2ed6514dfd7b85 Mon Sep 17 00:00:00 2001 From: Jesse Lewis Date: Wed, 22 Aug 2012 15:05:35 -0500 Subject: [PATCH] Migrated first_notice_at to Problem --- db/migrate/20120822195841_set_first_notice_at_on_problems.rb | 10 ++++++++++ 1 file changed, 10 insertions(+), 0 deletions(-) create mode 100644 db/migrate/20120822195841_set_first_notice_at_on_problems.rb diff --git a/db/migrate/20120822195841_set_first_notice_at_on_problems.rb b/db/migrate/20120822195841_set_first_notice_at_on_problems.rb new file mode 100644 index 0000000..a81bbec --- /dev/null +++ b/db/migrate/20120822195841_set_first_notice_at_on_problems.rb @@ -0,0 +1,10 @@ +class SetFirstNoticeAtOnProblems < Mongoid::Migration + def self.up + Problem.all.each do |problem| + problem.update_attribute :first_notice_at, problem.notices.order_by([:created_at, :asc]).first.try(:created_at) + end + end + + def self.down + end +end \ No newline at end of file -- libgit2 0.21.2