Merge Request #2

Merged
softwarepublico/spb_migrations!2
Created by Fabio Teixeira

Blog migrations

Apply short+pic to all communities blog posts visualization.

Assignee: Thiago Ribeiro
Milestone: None

Merged by Arthur Esposte

Source branch has been removed
Commits (1)
2 participants
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
... ...