diff --git a/lib/cancan/inherited_resource.rb b/lib/cancan/inherited_resource.rb index 089cfc1..81bca5b 100644 --- a/lib/cancan/inherited_resource.rb +++ b/lib/cancan/inherited_resource.rb @@ -13,7 +13,7 @@ module CanCan end def resource_base - @controller.send :collection + @controller.send :end_of_association_chain end end end diff --git a/spec/cancan/inherited_resource_spec.rb b/spec/cancan/inherited_resource_spec.rb index f775ff4..dc4cc58 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.collection" do + it "index should load through @controller.end_of_association_chain" do @params[:action] = "index" stub(Project).accessible_by(@ability, :index) { :projects } - stub(@controller).collection { Project } + stub(@controller).end_of_association_chain { Project } CanCan::InheritedResource.new(@controller).load_resource @controller.instance_variable_get(:@projects).should == :projects end