move model code out of migration

This commit is contained in:
David Gil
2015-08-12 13:46:02 +02:00
parent 1ee3378768
commit 7c8948639f
2 changed files with 2 additions and 5 deletions

View File

@@ -1,10 +1,6 @@
class AddChildrenCountToComments < ActiveRecord::Migration
def up
add_column :comments, :children_count, :integer, default: 0
Comment.find_each do |comment|
Comment.reset_counters(comment.id, :children)
end
end
def down