Commit 20dd43a26ebca988bf8a73f57e44278edbc5dd3e
Exists in
master
and in
1 other branch
Merge branch 'blog_migrations'
Showing
1 changed file
with
23 additions
and
0 deletions
Show diff stats
db/migrate/20150915141403_apply_short_plus_pic_to_all_communities_blogs.rb
0 → 100644
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +class ApplyShortPlusPicToAllCommunitiesBlogs < ActiveRecord::Migration | ||
2 | + def up | ||
3 | + Community.all.each do |community| | ||
4 | + set_short_plus_pic_to_blog community.blog | ||
5 | + end | ||
6 | + | ||
7 | + puts "" | ||
8 | + end | ||
9 | + | ||
10 | + def down | ||
11 | + say "This can't be reverted" | ||
12 | + end | ||
13 | + | ||
14 | + private | ||
15 | + | ||
16 | + def set_short_plus_pic_to_blog blog | ||
17 | + if blog | ||
18 | + blog.visualization_format = "short+pic" | ||
19 | + blog.save! | ||
20 | + print "." | ||
21 | + end | ||
22 | + end | ||
23 | +end |