Commit e3b74f50f4cba43f336999a0259741895187d6b7
1 parent
b73a08dd
Exists in
master
and in
22 other branches
Use the proper method for selecting from the database
(ActionItem1733)
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
db/migrate/20101202205446_remove_published_articles.rb
1 | 1 | class RemovePublishedArticles < ActiveRecord::Migration |
2 | 2 | def self.up |
3 | 3 | select_all("SELECT * from articles WHERE type = 'PublishedArticle'").each do |published| |
4 | - reference = select('select * from articles where id = %d' % published['reference_article_id']).first | |
4 | + reference = select_one('select * from articles where id = %d' % published['reference_article_id']) | |
5 | 5 | if reference |
6 | 6 | execute(ActiveRecord::Base.sanitize_sql(["UPDATE articles SET type = ?, abstract = ?, body = ? WHERE articles.id = ?", reference['type'], reference['abstract'], reference['body'], published['id']])) |
7 | 7 | else | ... | ... |