Sha256: 9554aef4f8c6c743310f58d5b8f74ffeab918756577e3f42c2d46249475e9b75
Contents?: true
Size: 444 Bytes
Versions: 10
Compression:
Stored size: 444 Bytes
Contents
class FixUserlessArticles < ActiveRecord::Migration def self.up unless $schema_generator articles = Article.find(:all) STDERR.puts "Fixing articles with empty user_id" articles.each do |article| if article.user.nil? STDERR.puts "Fixing article #{article.id} having empty user" article.user_id = 1 article.save! end end end end def self.down end end
Version data entries
10 entries across 10 versions & 1 rubygems