Class: UrlHelper

Inherits:
Object
  • Object
show all
Includes:
RouteUrlHelpers, Singleton
Defined in:
app/models/url_helper.rb

Overview

Singleton that mixes in Rails route URL helpers so non-controller
code (mailers, jobs, models composing emails, etc.) can call
UrlHelper.instance.foo_url without instantiating a controller.
Defaults to https for absolute URLs.

Constant Summary

Constants included from RouteUrlHelpers

RouteUrlHelpers::ROUTES

Class Method Summary collapse

Class Method Details

.default_url_options(options = {}) ⇒ Hash

Returns { protocol: 'https' } merged with options.

Parameters:

  • options (Hash) (defaults to: {})

    extra url options merged over the defaults

Options Hash (options):

  • host (String)

    url host

  • port (Integer)

    url port

  • protocol (String)

    url protocol override

Returns:

  • (Hash)

    { protocol: 'https' } merged with options



15
16
17
# File 'app/models/url_helper.rb', line 15

def self.default_url_options(options = {})
  { protocol: 'https' }.merge(options)
end