Sha256: ab66c27afcd11932641018ce8fa424c813653f489112f7f134497cf6ee6e6350
Contents?: true
Size: 392 Bytes
Versions: 11
Compression:
Stored size: 392 Bytes
Contents
# This migration comes from tb_blog (originally 20120413020437) class AddCommentsCounterToSpudPosts < ActiveRecord::Migration def self.up add_column :spud_posts, :comments_count, :integer, :default => 0 SpudPost.find_each do |post| post.comments_count = post.comments.count post.save end end def self.down remove_column :spud_posts, :comments_count end end
Version data entries
11 entries across 11 versions & 1 rubygems