From 8722fbc7a5e8101fdf3be037177761730733629c Mon Sep 17 00:00:00 2001 From: Stefano Verna Date: Thu, 17 Feb 2011 22:31:17 +0100 Subject: [PATCH] Fix for deeply nested resources when using inherited resources --- lib/cancan/inherited_resource.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cancan/inherited_resource.rb b/lib/cancan/inherited_resource.rb index cee940f..81bca5b 100644 --- a/lib/cancan/inherited_resource.rb +++ b/lib/cancan/inherited_resource.rb @@ -3,7 +3,8 @@ module CanCan class InheritedResource < ControllerResource # :nodoc: def load_resource_instance if parent? - @controller.send :parent + @controller.send :association_chain + @controller.instance_variable_get("@#{instance_name}") elsif new_actions.include? @params[:action].to_sym @controller.send :build_resource else