From e3eab13b860ad6e21d7d5ab4a6f7e85827e87979 Mon Sep 17 00:00:00 2001 From: Trond Arve Nordheim Date: Tue, 8 Mar 2011 10:45:34 +0100 Subject: [PATCH] Use collection instead of end_of_association_chain in the inherited_resources integration, as per suggested by aq1018 --- lib/cancan/inherited_resource.rb | 2 +- spec/cancan/inherited_resource_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cancan/inherited_resource.rb b/lib/cancan/inherited_resource.rb index cee940f..0403281 100644 --- a/lib/cancan/inherited_resource.rb +++ b/lib/cancan/inherited_resource.rb @@ -12,7 +12,7 @@ module CanCan end def resource_base - @controller.send :end_of_association_chain + @controller.send :collection end end end diff --git a/spec/cancan/inherited_resource_spec.rb b/spec/cancan/inherited_resource_spec.rb index 44cff3e..09dc9d7 100644 --- a/spec/cancan/inherited_resource_spec.rb +++ b/spec/cancan/inherited_resource_spec.rb @@ -32,10 +32,10 @@ describe CanCan::InheritedResource do @controller.instance_variable_get(:@project).should == :project_resource end - it "index should load through @controller.end_of_association_chain" do + it "index should load through @controller.collection" do @params[:action] = "index" stub(Project).accessible_by(@ability, :index) { :projects } - stub(@controller).end_of_association_chain { Project } + stub(@controller).collection { Project } CanCan::InheritedResource.new(@controller).load_resource @controller.instance_variable_get(:@projects).should == :projects end