Commit 44f0045482bb4787e5d91d0e212abcdceab48c73
1 parent
7377bb8a
Exists in
master
and in
1 other branch
Set all blogs to use short+pic on its posts visualization
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
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 @@ |
| 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 | ... | ... |