Skip to content
Browse files

fix pluralize error on index action when passing resource name - closes

#143 again
  • Loading branch information...
1 parent 9d91545 commit a5ff826e40f7a3999ab26b164e7ea9de44831367 @ryanb ryanb committed Sep 7, 2010
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/cancan/controller_resource.rb
  2. +1 −1 spec/cancan/controller_resource_spec.rb
View
2 lib/cancan/controller_resource.rb
@@ -29,7 +29,7 @@ def load_resource
if !resource_instance && (parent? || member_action?)
@controller.instance_variable_set("@#{instance_name}", load_resource_instance)
elsif load_collection?
- @controller.instance_variable_set("@#{instance_name.pluralize}", load_collection)
+ @controller.instance_variable_set("@#{instance_name.to_s.pluralize}", load_collection)
end
end
View
2 spec/cancan/controller_resource_spec.rb
@@ -67,7 +67,7 @@
it "should build a collection when on index action when class responds to accessible_by" do
stub(Project).accessible_by(@ability) { :found_projects }
@params[:action] = "index"
- resource = CanCan::ControllerResource.new(@controller)
+ resource = CanCan::ControllerResource.new(@controller, :project)
resource.load_resource
@controller.instance_variable_get(:@project).should be_nil
@controller.instance_variable_get(:@projects).should == :found_projects

0 comments on commit a5ff826

Please sign in to comment.
Something went wrong with that request. Please try again.