Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
before_filter :set_site after_filter do |c| c.class.page_cache_directory = c.site.directory_for(:cache) end attr_reader :site private def set_site # Redirect to non-www address before we even hit the database! if request.subdomains.first == "www" if request.subdomains == ["www"] redirect_to "#{request.protocol}#{request.domain}#{request.port_string}#{request.path}" else subdomains = request.subdomains.shift.join(".") subdomains << "." unless subdomains.blank? redirect_to "#{request.protocol}#{subdomains}#{request.domain}#{request.port_string}#{request.path}" end else @site = Site.find_by_host(request.host) end end
This paste will be private.
From the Design Piracy series on my blog: