Class: Orange::Middleware::SubsiteLoad
- Defined in:
- lib/orange-more/subsites/middleware/subsite_load.rb
Overview
This will load information about the site to into the orange env
-
packet will be an instance of the site object
Instance Method Summary collapse
Methods inherited from Base
#call, #init, #initialize, #inspect, #orange, #pass, #recapture
Constructor Details
This class inherits a constructor from Orange::Middleware::Base
Instance Method Details
#packet_call(packet) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/orange-more/subsites/middleware/subsite_load.rb', line 7 def packet_call(packet) if packet['site'] site = packet['site'] path = packet['route.path'] || packet.request.path_info # Find the subsite in the sitemap table extras, matched = orange[:sitemap].find_route_info(packet, path) # If matched, update the loaded site and trim the path down a bit if !matched.resource.blank? && matched.resource.to_sym == :subsites if(m = site.subsites.first(:id => matched.resource_id)) packet['route.main_site_route'] = matched packet['route.path'] = extras packet['subsite'] = m end end end pass packet end |