fixes #1660
This commit is contained in:
@@ -875,8 +875,8 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module VersionMethods
|
||||
def create_version
|
||||
if new_record? || rating_changed? || source_changed? || parent_id_changed? || tag_string_changed?
|
||||
def create_version(force = false)
|
||||
if new_record? || rating_changed? || source_changed? || parent_id_changed? || tag_string_changed? || force
|
||||
CurrentUser.increment!(:post_update_count)
|
||||
versions.create(
|
||||
:rating => rating,
|
||||
|
||||
@@ -15,3 +15,13 @@ ForumTopic.find_each do |topic|
|
||||
topic.update_column(:updater_id, last.creator_id) if topic.updater_id != last.creator_id
|
||||
topic.update_column(:updated_at, last.updated_at) if topic.updated_at != last.updated_at
|
||||
end
|
||||
|
||||
admin = User.admins.first
|
||||
|
||||
CurrentUser.scoped(admin, "127.0.0.1") do
|
||||
Post.where("created_at >= ?", "2013-02-01").find_each do |post|
|
||||
if post.tag_string != post.versions.last.tag_string
|
||||
post.create_version(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user