Module: ForeignDomainRouting

Defined in:
lib/foreign_domain_routing.rb,
lib/foreign_domain_routing/routing_extensions.rb

Defined Under Namespace

Modules: Controller, RouteExtensions, RouteSetExtensions

Constant Summary collapse

DEFAULT_NATIVE_DOMAINS =
{:development => ['localhost:3000'], :test => ['test.host'], :production => ['example.com'] }
@@init_native_domains =
DEFAULT_NATIVE_DOMAINS.dup

Class Method Summary collapse

Class Method Details

.foreign_domain?(host) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
# File 'lib/foreign_domain_routing.rb', line 16

def self.foreign_domain?(host)
  native_domains.each do |domain|
    return false if host =~ /#{domain}\Z/i
  end
  true
end

.native_domainsObject



8
9
10
# File 'lib/foreign_domain_routing.rb', line 8

def self.native_domains
  init_native_domains[RAILS_ENV.to_sym]
end

.native_domains=(value) ⇒ Object



12
13
14
# File 'lib/foreign_domain_routing.rb', line 12

def self.native_domains=(value)
  init_native_domains[RAILS_ENV.to_sym] = value
end