mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Initial release of Discourse
This commit is contained in:
9
lib/tasks/add_topic_to_quotes.rake
Normal file
9
lib/tasks/add_topic_to_quotes.rake
Normal file
@@ -0,0 +1,9 @@
|
||||
desc "Add the topic to quotes"
|
||||
task "add_topic_to_quotes" => :environment do
|
||||
Post.where("raw like '%topic:%'").each do |p|
|
||||
new_raw = p.raw.gsub(/topic:(\d+)\]/, "topic:#{p.topic_id}\"]")
|
||||
new_cooked = p.cook(new_raw, topic_id: p.topic_id)
|
||||
Post.update_all ["raw = ?, cooked = ?", new_raw, new_cooked], ["id = ?", p.id]
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user