Skip to content

Commit

Permalink
ensure request exits
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vergés authored and Ivan Vergés committed Dec 2, 2024
1 parent c7866f1 commit e20805e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/decidim/decidim_awesome/organization_memoizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.memoize(key)
# memoize a piece of code in the class instead of the instance (helper are initialized for each view)
# only works if request.env["decidim.current_organization"] is defined
def memoize(key, &)
return yield unless request.env["decidim.current_organization"]&.id
return yield unless defined?(request) && request.env["decidim.current_organization"]&.id

OrganizationMemoizer.memoize("#{request.env["decidim.current_organization"].id}-#{key}", &)
end
Expand Down

0 comments on commit e20805e

Please sign in to comment.