move model code out of migration
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user