Class | Site |
In: |
app/models/site.rb
|
Parent: | ActiveRecord::Base |
# File app/models/site.rb, line 12 12: def self.find_by_domain(domain) 13: d = domain.clone 14: strip_www!(d) 15: if site = first(:conditions => {:domain => d}) 16: site 17: else 18: default.first 19: end 20: end
# File app/models/site.rb, line 22 22: def self.strip_www!(d) 23: return unless d 24: d.sub!(/\Awww./,'') 25: end
# File app/models/site.rb, line 35 35: def set_default 36: if self.class.default.count < 1 37: update_attribute(:the_default, true) 38: end 39: end