Classify causes plural model names to be incorrectly renamed

Some model names will be renamed incorrectly e.g. 'business'. It should
be the responsibility of the user to make sure they use a name that
directly corresponds to the model name. The only filtering performed
should be camelize.
This commit is contained in:
Oliver Morgan 2012-05-31 10:45:55 +01:00
parent 78cbcf1db9
commit 245b83f6b4
2 changed files with 3 additions and 3 deletions

View File

@ -145,7 +145,7 @@ module CanCan
def resource_class
case @options[:class]
when false then name.to_sym
when nil then (@name || namespaced_name).to_s.classify.constantize
when nil then (@name || namespaced_name).to_s.camelize.constantize
when String then @options[:class].constantize
else @options[:class]
end

View File

@ -222,8 +222,8 @@ describe CanCan::ControllerResource do
}
@controller.instance_variable_get(:@project).should be_nil
end
it "named resources should not be loaded independently of the controller" do
it "named resources should be loaded independently of the controller name" do
category = Category.create!
@params.merge!(:action => "new", :category_id => category.id)