From 2104011bf65fd8d79b8ea710e9960b88ea5ea2ca Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Tue, 21 Dec 2010 12:24:48 -0300 Subject: [PATCH] Fix migration to generate proper SQL --- db/migrate/20101202205446_remove_published_articles.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20101202205446_remove_published_articles.rb b/db/migrate/20101202205446_remove_published_articles.rb index 3be4ac8..b9d0fd8 100644 --- a/db/migrate/20101202205446_remove_published_articles.rb +++ b/db/migrate/20101202205446_remove_published_articles.rb @@ -3,7 +3,7 @@ class RemovePublishedArticles < ActiveRecord::Migration select_all("SELECT * from articles WHERE type = 'PublishedArticle'").each do |published| reference = Article.exists?(published['reference_article_id']) ? Article.find(published['reference_article_id']) : nil if reference - execute("UPDATE articles SET type = '#{reference.type}', abstract = '#{reference.abstract}', body = '#{reference.body}' WHERE articles.id = #{published['id']}") + execute(ActiveRecord::Base.sanitize_sql(["UPDATE articles SET type = ?, abstract = ?, body = ? WHERE articles.id = ?", reference.type, reference.abstract, reference.body, published['id']])) else execute("DELETE from articles where articles.id = #{published['id']}") end -- libgit2 0.21.2