Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use collection instead of end_of_association_chain in the inherited_r…

…esources integration, as per suggested by aq1018
  • Loading branch information...
commit e3eab13b860ad6e21d7d5ab4a6f7e85827e87979 1 parent 79995e4
@tanordheim tanordheim authored
View
2  lib/cancan/inherited_resource.rb
@@ -12,7 +12,7 @@ def load_resource_instance
end
def resource_base
- @controller.send :end_of_association_chain
+ @controller.send :collection
end
end
end
View
4 spec/cancan/inherited_resource_spec.rb
@@ -32,10 +32,10 @@
@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
Please sign in to comment.
Something went wrong with that request. Please try again.