Class: Cms::Site
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Cms::Site
- Defined in:
- app/models/cms/site.rb
Instance Attribute Summary collapse
-
#logo_file ⇒ Object
Returns the value of attribute logo_file.
Class Method Summary collapse
-
.find_site(host, path = nil) ⇒ Object
– Class Methods ——————————————————– returning the Cms::Site instance based on host and path.
Instance Method Summary collapse
-
#destroy ⇒ Object
– Instance Methods —————————————————– When removing entire site, let’s not destroy content from other sites Since before_destroy doesn’t really work, this does the trick.
Instance Attribute Details
#logo_file ⇒ Object
Returns the value of attribute logo_file.
7 8 9 |
# File 'app/models/cms/site.rb', line 7 def logo_file @logo_file end |
Class Method Details
.find_site(host, path = nil) ⇒ Object
– Class Methods ——————————————————– returning the Cms::Site instance based on host and path
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/models/cms/site.rb', line 58 def self.find_site(host, path = nil) return Cms::Site.first if Cms::Site.count == 1 cms_site = nil Cms::Site.find_all_by_hostname(real_host_from_aliases(host)).each do |site| if site.path.blank? cms_site = site elsif "#{path.to_s.split('?')[0]}/".match /^\/#{Regexp.escape(site.path.to_s)}\// cms_site = site break end end return cms_site end |
Instance Method Details
#destroy ⇒ Object
– Instance Methods —————————————————– When removing entire site, let’s not destroy content from other sites Since before_destroy doesn’t really work, this does the trick
75 76 77 78 |
# File 'app/models/cms/site.rb', line 75 def destroy self.class.update_all({:is_mirrored => false}, :id => self.id) if self.is_mirrored? super end |