Class: Handcart::Subdomain

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/handcart/subdomain.rb

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/handcart/subdomain.rb', line 18

def self.matches?(request)
  my_subdomain = Subdomain.find_by_name(request.subdomain)
  if my_subdomain && request.subdomain.present? && !Handcart.reserved_subdomains.include?(request.subdomain) && my_subdomain.handcart
    if my_subdomain.handcart.respond_to?(:active?)
      my_subdomain.handcart.active?
    else
      # Just default to true since we found the record
      true
    end
  end
end