13 lines
272 B
Ruby
13 lines
272 B
Ruby
|
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
|