socialforge/db/migrate/20160111071529_static_proje...

13 lines
272 B
Ruby
Raw Normal View History

2016-01-12 10:38:50 +08:00
class StaticProjectNews < ActiveRecord::Migration
def up
Project.all.each do |project|
news_count = project.news.count
project.update_attribute(:news_count, news_count)
end
end
def down
Project.all.update_all(:news_count => false)
end
end