From 6fd369b91e638ef818272355638b88caabf4e96e Mon Sep 17 00:00:00 2001 From: Michael Witrant Date: Sat, 7 Jul 2012 10:27:59 +0200 Subject: [PATCH 1/2] fixed AddRenderedNotes migration on Rails > 3.1 --- db/migrate/20120412072508_add_rendered_notes.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/migrate/20120412072508_add_rendered_notes.rb b/db/migrate/20120412072508_add_rendered_notes.rb index 25fa4603..bbf813c4 100644 --- a/db/migrate/20120412072508_add_rendered_notes.rb +++ b/db/migrate/20120412072508_add_rendered_notes.rb @@ -9,7 +9,11 @@ class AddRenderedNotes < ActiveRecord::Migration # Call save! on each todo to force generation of rendered_todos i=0; max = Todo.all.count; start = Time.now Todo.all.each do |todo| - todo.save(false) + if Rails.version < '3.0' + todo.save(false) + else + todo.save(:validate => false) + end i = i + 1 if i%250==0 elapsed_sec = (Time.now-start) From 0572a89a4db1abbab4b9b065ba6e13aa337a6372 Mon Sep 17 00:00:00 2001 From: Michael Witrant Date: Sun, 8 Jul 2012 21:10:54 +0200 Subject: [PATCH 2/2] removed support for Rails < 3.0 --- db/migrate/20120412072508_add_rendered_notes.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/db/migrate/20120412072508_add_rendered_notes.rb b/db/migrate/20120412072508_add_rendered_notes.rb index bbf813c4..c458668c 100644 --- a/db/migrate/20120412072508_add_rendered_notes.rb +++ b/db/migrate/20120412072508_add_rendered_notes.rb @@ -9,11 +9,7 @@ class AddRenderedNotes < ActiveRecord::Migration # Call save! on each todo to force generation of rendered_todos i=0; max = Todo.all.count; start = Time.now Todo.all.each do |todo| - if Rails.version < '3.0' - todo.save(false) - else - todo.save(:validate => false) - end + todo.save(:validate => false) i = i + 1 if i%250==0 elapsed_sec = (Time.now-start)