<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -628,7 +628,7 @@ module Ardes#:nodoc:
       
       # returns the name of the immediately enclosing resource
       def enclosing_resource_name
-        enclosing_resource.class.name.underscore
+        @enclosing_resource_name
       end
       
       # returns the resource service for the controller - this will be lazilly created
@@ -781,6 +781,7 @@ module Ardes#:nodoc:
         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;@enclosing_resource_name&quot;, options[:name])
         instance_variable_set(&quot;@#{name}&quot;, resource)
         instance_variable_set(&quot;@#{options[:as]}&quot;, resource) if options[:as]
       end</diff>
      <filename>lib/ardes/resources_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,23 +15,23 @@ describe &quot;ResourcesController (in general)&quot; do
   it &quot;resources_controller_for :forums, :in =&gt; [:user, '*', '*', :comment] should raise argument error (no multiple wildcards in a row)&quot; do
     lambda { @controller.resources_controller_for :forums, :in =&gt; [:user, '*', '*', :comment] }.should raise_error(ArgumentError)
   end
-  
-  
 end
 
 describe &quot;ResourcesController#enclosing_resource_name&quot; do
   before do
-    @controller = ForumsController.new
+    @controller = TagsController.new
+    info = mock_model(Info, :tags =&gt; [])
+    @controller.stub!(:current_user).and_return(mock_model(User, :info =&gt; info))
+    @controller.stub!(:recognized_route).and_return(ActionController::Routing::Routes.named_routes[:account_info_tags])
+    @controller.send :load_enclosing_resources
   end
 
-  it &quot;should be the class name underscored&quot; do
-    @controller.instance_variable_set('@enclosing_resources', [mock_model(User)])
-    @controller.enclosing_resource_name.should == 'user'
+  it &quot;should be the name of the mapped enclosing_resource&quot; do
+    @controller.enclosing_resource_name.should == 'info'
   end
 end
 
 describe &quot;A controller's resource_service&quot; do
-  
   before do
     @controller = ForumsController.new
   end
@@ -54,4 +54,4 @@ describe &quot;deprecated methods&quot; do
       @controller.save_resource
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>spec/lib/resources_controller_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>264608d09733b602cb3a4e97db7c0a9cc10c56a6</id>
    </parent>
  </parents>
  <author>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </author>
  <url>http://github.com/ianwhite/resources_controller/commit/40174b572fa933173d5d3c1983eaad7da015b13f</url>
  <id>40174b572fa933173d5d3c1983eaad7da015b13f</id>
  <committed-date>2008-10-10T16:35:22-07:00</committed-date>
  <authored-date>2008-10-10T16:35:22-07:00</authored-date>
  <message>enclosing_resource_name is the name of the mapped enclosing resource (which may not be the class name underscored).
This keeps parity with resource_name, and allows sending params to the enclosing_resource_path like enclosing_resource_path(enclosing_resource_name =&gt; {:enabled =&gt; true})</message>
  <tree>ff4b9869683f22e3112882198948c255f3746e50</tree>
  <committer>
    <name>Ian White</name>
    <email>ian.w.white@gmail.com</email>
  </committer>
</commit>
