Module: Jets::CommonMethods

Included in:
AssetTagHelper, UrlHelper
Defined in:
lib/jets/rails_overrides/common_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_stage_name(url) ⇒ Object

Add API Gateway Stage Name



3
4
5
6
7
8
9
10
11
12
# File 'lib/jets/rails_overrides/common_methods.rb', line 3

def add_stage_name(url)
  if request.host.include?("amazonaws.com") &&
          url.starts_with?('/') &&
          !url.starts_with?('http')
    stage_name = Jets::Cfn::TemplateMappers::ApiGatewayDeploymentMapper.stage_name
    url = "/#{stage_name}#{url}"
  end

  url
end