keep original functionality but redirect to root path if referrer equals current url

This commit is contained in:
Dmitri Kondratjev
2025-09-08 19:37:49 +03:00
parent 6e9e5bcaa8
commit 19153f41be
2 changed files with 4 additions and 2 deletions

View File

@@ -23,7 +23,9 @@ module ApplicationHelper
end
def link_back
link_back_to request.referrer || root_path
back_url = request.referrer
back_url = root_path if back_url.nil? || back_url == request.url
link_back_to back_url
end
def link_back_to(destination)

View File

@@ -2,7 +2,7 @@
<% content_for :nav do %>
<div class="flex-item-justify-start">
<%= link_back_to_last_room_visited %>
<%= link_back %>
</div>
<div class="flex-item-justify-end">