Commit 0cc411fca037d2f52de9660f20b6274054c6eefc
1 parent
4c9ca01b
Exists in
master
and in
22 other branches
Avoiding crash when passing nil to YAML.load()
(Again!) (ActionItem894)
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
db/migrate/20101205034144_add_language_and_translation_of_id_to_article.rb
... | ... | @@ -9,7 +9,7 @@ class AddLanguageAndTranslationOfIdToArticle < ActiveRecord::Migration |
9 | 9 | add_index :articles, :translation_of_id |
10 | 10 | |
11 | 11 | select_all("select id, setting from articles where type = 'Blog'").each do |blog| |
12 | - settings = YAML.load(blog['setting']) | |
12 | + settings = YAML.load(blog['setting'] || {}.to_yaml) | |
13 | 13 | settings[:display_posts_in_current_language] = true |
14 | 14 | assignments = ActiveRecord::Base.sanitize_sql_for_assignment(:setting => settings.to_yaml) |
15 | 15 | update("update articles set %s where id = %d" % [assignments, blog['id']]) | ... | ... |