Module: Warped::Emails::Helpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/warped/emails/helpers.rb

Instance Method Summary collapse

Instance Method Details

#base_urlObject



21
22
23
# File 'lib/warped/emails/helpers.rb', line 21

def base_url
  ENV["FRONTEND_URL"].presence || ENV["SERVER_HOST"].presence || "http://localhost:3000"
end

#frontend_url(path = []) ⇒ Object



14
15
16
17
18
19
# File 'lib/warped/emails/helpers.rb', line 14

def frontend_url(path = [])
  frontend_path = Array(path)

  url = base_url
  path ? [url, *frontend_path].join("/").gsub(%r{(?<!:)//}, "/") : url
end