<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -785,14 +785,18 @@ module Ardes#:nodoc:
       def load_enclosing_resource_from_specification(spec)
         spec.segment == route_enclosing_names[enclosing_resources.size].first or ResourcesController.raise_resource_mismatch(self)
         returning spec.find_from(self) do |resource|
-          update_name_prefix(spec.name_prefix)
-          enclosing_resources &lt;&lt; resource
-          enclosing_collection_resources &lt;&lt; resource unless spec.singleton?
-          instance_variable_set(&quot;@#{spec.name}&quot;, resource)
-          instance_variable_set(&quot;@#{spec.as}&quot;, resource) if spec.as
+          add_enclosing_resource(resource, spec.name, :name_prefix =&gt; spec.name_prefix, :is_singleton =&gt; spec.singleton?, :as =&gt; spec.as )
         end
       end
-        
+      
+      def add_enclosing_resource(resource, name, options = {})
+        update_name_prefix(options[:name_prefix] || (options[:name_prefix] == false ? '' : &quot;#{name}_&quot;))
+        enclosing_resources &lt;&lt; resource
+        enclosing_collection_resources &lt;&lt; resource unless options[:is_singleton]
+        instance_variable_set(&quot;@#{name}&quot;, resource)
+        instance_variable_set(&quot;@#{options[:as]}&quot;, resource) if options[:as]
+      end
+      
       # The name prefix is used for forwarding urls and will be different depending on
       # which route the controller was invoked by.  The resource specifications build
       # up the name prefix as the resources are loaded.</diff>
      <filename>lib/ardes/resources_controller.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d82eedac75ba1eb821c50fe542df956b89be73db</id>
    </parent>
  </parents>
  <author>
    <name>Joel Chippindale</name>
    <email>joel.chippindale@gmail.com</email>
  </author>
  <url>http://github.com/ianwhite/resources_controller/commit/93b29a469bf994434f3e661f29fefc5f51bd4109</url>
  <id>93b29a469bf994434f3e661f29fefc5f51bd4109</id>
  <committed-date>2008-10-09T06:56:04-07:00</committed-date>
  <authored-date>2008-10-09T06:56:04-07:00</authored-date>
  <message>Extracted #add_enclosing_resource from #load_enclosing_resource_from_specification

This makes it much easier to override #load_enclosing_resources in your controller if
you have a route (or set of routes) which cannot easily be mapped onto a specification.</message>
  <tree>e69ab26c055e7c34ec1775097d4c45cb9e88d2c7</tree>
  <committer>
    <name>Joel Chippindale</name>
    <email>joel.chippindale@gmail.com</email>
  </committer>
</commit>
