diff options
Diffstat (limited to 'app/models/route.rb')
-rw-r--r-- | app/models/route.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/app/models/route.rb b/app/models/route.rb index 2f6b0a8e8f1..f2fe1664f9e 100644 --- a/app/models/route.rb +++ b/app/models/route.rb @@ -39,17 +39,17 @@ class Route < ApplicationRecord attributes[:name] = route.name.sub(name_before_last_save, name) end - if attributes.present? - old_path = route.path + next if attributes.empty? - # Callbacks must be run manually - route.update_columns(attributes.merge(updated_at: Time.current)) + old_path = route.path - # We are not calling route.delete_conflicting_redirects here, in hopes - # of avoiding deadlocks. The parent (self, in this method) already - # called it, which deletes conflicts for all descendants. - route.create_redirect(old_path) if attributes[:path] - end + # Callbacks must be run manually + route.update_columns(attributes.merge(updated_at: Time.current)) + + # We are not calling route.delete_conflicting_redirects here, in hopes + # of avoiding deadlocks. The parent (self, in this method) already + # called it, which deletes conflicts for all descendants. + route.create_redirect(old_path) if attributes[:path] end end |