Skip to content

Instantly share code, notes, and snippets.

@edlvj
Created June 6, 2019 12:19
Show Gist options
  • Save edlvj/056b8385e3163806e7d3efb071deaba4 to your computer and use it in GitHub Desktop.
Save edlvj/056b8385e3163806e7d3efb071deaba4 to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
# Copyright (c) 2017-2019 SwiftComply
#
# Grease Trap Back Path
module GreaseTrapBackPath
extend ActiveSupport::Concern
def set_grease_traps_back_path
return city_grease_traps_path unless request.referer
return referer_path if is_establishment_refer_path?
city_grease_traps_path
end
def is_establishment_refer_path?
referer_path.include?(city_establishments_path)
end
def referer_path
URI(request.referer).path
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment