backend/app/models/concerns/utils.rb
def abs_url url, host
    uri = url
    puts host
    protocol = host =~ /localhost/ ? 'http' : 'https'
    if uri && uri !~ /^http/
      uri = "#{protocol}://#{host}#{uri}"
    end
    uri
  end
# Returns an absolute URL with the host and the passed url.
# Example:
#  url = abs_url '/images/example.png', 'manshar.me'
#  url == '//manshar.me/images/example.png'
Returns an absolute URL with the host and the passed url.
Returns an absolute URL with the host and the passed url .
def abs_url url, host
    uri = url
    puts host
    protocol = host =~ /localhost/ ? 'http' : 'https'
    if uri && uri !~ /^http/
      uri = "#{protocol}://#{host}#{uri}"
    end
    uri
  end
def abs_url url , host uri = url puts host protocol = host =~ / localhost / ? 'http' : 'https' if uri && uri !~ / ^http / uri = "#{protocol}://#{host}#{uri}" end uri end
Returns an absolute URL with the host and the passed url.
Returns an absolute URL with the host and the passed url .
url
host