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
49 50 51 52 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 49 def add_subdomain_to_domains self.domains ||= [] (self.domains << self.full_subdomain).uniq! end |
#domains=(array) ⇒ Object
44 45 46 47 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 44 def domains=(array) array.reject!(&:blank?) array = [] if array.blank?; super(array.map(&:downcase)) end |
#domains_with_subdomain ⇒ Object
58 59 60 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 58 def domains_with_subdomain ((self.domains || []) + [self.full_subdomain]).uniq end |
#domains_without_subdomain ⇒ Object
54 55 56 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 54 def domains_without_subdomain (self.domains || []) - [self.full_subdomain_was] - [self.full_subdomain] end |
#full_subdomain ⇒ Object
62 63 64 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 62 def full_subdomain "#{self.subdomain}.#{Locomotive.config.domain}" end |
#full_subdomain_was ⇒ Object
66 67 68 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 66 def full_subdomain_was "#{self.subdomain_was}.#{Locomotive.config.domain}" end |
#subdomain=(subdomain) ⇒ Object
40 41 42 |
# File 'app/models/locomotive/extensions/site/subdomain_domains.rb', line 40 def subdomain=(subdomain) super(subdomain.try(:downcase)) end |