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:
parent
78cbcf1db9
commit
245b83f6b4
|
@ -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
|
||||
|
|
|
@ -223,7 +223,7 @@ 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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user