diff --git a/app/models/concerns/with_permalink.rb b/app/models/concerns/with_permalink.rb index 37fa6d0bf865851a04fc37b66795e3b8bb49be47..73c63fc119d08e18cd1f4b87e40d87fa9765c595 100644 --- a/app/models/concerns/with_permalink.rb +++ b/app/models/concerns/with_permalink.rb @@ -23,8 +23,8 @@ module WithPermalink new_permalink = new_permalink_in_website(website) # If the object had no permalink or if its path changed, we create a new permalink - if new_permalink.computed_path.present? && (last_permalink.nil? || last_permalink.path != new_permalink.computed_path) - last_permalink&.update(is_current: false) + if new_permalink.computed_path.present? && (current_permalink.nil? || current_permalink.path != new_permalink.computed_path) + current_permalink&.update(is_current: false) new_permalink.path = new_permalink.computed_path new_permalink.save end