Module: Locomotive::Extensions::Site::SubdomainDomains::InstanceMethods
- Defined in:
- app/models/locomotive/extensions/site/subdomain_domains.rb
Instance Method Summary collapse
- #add_subdomain_to_domains ⇒ Object
- #domains=(array) ⇒ Object
- #domains_with_subdomain ⇒ Object
- #domains_without_subdomain ⇒ Object
- #full_subdomain ⇒ Object
- #full_subdomain_was ⇒ Object
- #subdomain=(subdomain) ⇒ Object
Instance Method Details
#add_subdomain_to_domains ⇒ Object
50 51 52 53 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 50 def add_subdomain_to_domains self.domains ||= [] (self.domains << self.full_subdomain).uniq! end |
#domains=(array) ⇒ Object
45 46 47 48 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 45 def domains=(array) array.reject!(&:blank?) array = [] if array.blank?; super(array.map(&:downcase)) end |
#domains_with_subdomain ⇒ Object
59 60 61 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 59 def domains_with_subdomain ((self.domains || []) + [self.full_subdomain]).uniq end |
#domains_without_subdomain ⇒ Object
55 56 57 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 55 def domains_without_subdomain (self.domains || []) - [self.full_subdomain_was] - [self.full_subdomain] end |
#full_subdomain ⇒ Object
63 64 65 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 63 def full_subdomain "#{self.subdomain}.#{Locomotive.config.domain}" end |
#full_subdomain_was ⇒ Object
67 68 69 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 67 def full_subdomain_was "#{self.subdomain_was}.#{Locomotive.config.domain}" end |
#subdomain=(subdomain) ⇒ Object
41 42 43 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 41 def subdomain=(subdomain) super(subdomain.try(:downcase)) end |