cirandas.net

ref: master

db/migrate/20161207214218_change_highlights_block_attribute.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class ChangeHighlightsBlockAttribute < ActiveRecord::Migration
  def up
    HighlightsBlock.all.map do |block|
      block.settings[:block_images] = block.settings[:images]
      block.settings.delete(:images)
      block.save
    end
  end

  def down
    HighlightsBlock.all.map do |block|
      block.settings[:images] = block.settings[:block_images]
      block.settings.delete(:block_images)
      block.save
    end
  end
end