don't choke on empty YAML document as options

pull/596/head
Markus Kahl 11 years ago
parent 2dcb87f859
commit c9e2f557c7
  1. 5
      db/migrate/migration_utils/timelines.rb

@ -39,9 +39,8 @@ module Migration
def update_options(callback)
Proc.new do |row|
unless row[OPTIONS_COLUMN].blank?
timelines_opts = YAML.load(row[OPTIONS_COLUMN])
timelines_opts = YAML.load(row[OPTIONS_COLUMN].to_s)
if timelines_opts
migrated_options = callback.call(timelines_opts.clone) unless callback.nil?
row[OPTIONS_COLUMN] = YAML.dump(HashWithIndifferentAccess.new(migrated_options))

Loading…
Cancel
Save