We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f59c9a1 commit 6aa2969Copy full SHA for 6aa2969
app/helpers/tours_helper.rb
@@ -9,15 +9,15 @@ def start_tour(tourable, name)
9
10
# Renders the given tour to the UI
11
def render_tour(tourable, name)
12
- tour = tourable.tours.find_by(name: name)
+ tour = tourable&.tours&.find_by(name: name)
13
if tour&.active
14
@tour = tour
15
end
16
17
18
# Renders a "Back to tour" button if there's an active tour
19
def render_back_to_tour(tourable, name, url)
20
- if tourable.tours.find_by(name: name)&.active?
+ if tourable&.tours&.find_by(name: name)&.active?
21
@back_to_tour = url
22
23
0 commit comments