From e0b7df7fc589f2c6a29940d2661edb7ebd44c569 Mon Sep 17 00:00:00 2001 From: Nathan Sebhastian Date: Wed, 12 Sep 2018 00:38:42 +0700 Subject: [PATCH] update article path when username is changed (#626) --- app/models/user.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 5338e2d1a..55fadd0d8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -385,6 +385,10 @@ class User < ApplicationRecord c.slug = c.slug.gsub(username_was, username) c.save end + articles.find_each do |a| + a.path = a.path.gsub(username_was, username) + a.save + end end end