Sha256: adb712503631d632d437a98baa02886ddcf7d451fd4728d6dd094e2f7947f6c2
Contents?: true
Size: 725 Bytes
Versions: 8
Compression:
Stored size: 725 Bytes
Contents
require 'orange-core/middleware/base' module Orange::Middleware # This will load information about the site to into the orange env # - packet['site'] will be an instance of the site object # class SiteLoad < Base def packet_call(packet) url = packet['route.site_url'] site = OrangeSite.first(:url.like => url) if site packet['site'] = site elsif orange.options[:development_mode] || OrangeSite.all.size == 0 s = OrangeSite.new({:url => packet['route.site_url'], :name => 'An Orange Site'}) s.save packet['site'] = s else packet['site'] = OrangeSite.first end pass packet end end end
Version data entries
8 entries across 8 versions & 1 rubygems