pass action and subject through AccessDenied exception when :through isn't found - closes #366
This commit is contained in:
parent
74c9d582b2
commit
843fe89c63
|
@ -159,7 +159,7 @@ module CanCan
|
|||
elsif @options[:shallow]
|
||||
resource_class
|
||||
else
|
||||
raise AccessDenied # maybe this should be a record not found error instead?
|
||||
raise AccessDenied.new(nil, authorization_action, resource_class) # maybe this should be a record not found error instead?
|
||||
end
|
||||
else
|
||||
resource_class
|
||||
|
|
|
@ -235,7 +235,10 @@ describe CanCan::ControllerResource do
|
|||
resource = CanCan::ControllerResource.new(@controller, :through => :category)
|
||||
lambda {
|
||||
resource.load_resource
|
||||
}.should raise_error(CanCan::AccessDenied)
|
||||
}.should raise_error(CanCan::AccessDenied) { |exception|
|
||||
exception.action.should == :show
|
||||
exception.subject.should == Project
|
||||
}
|
||||
@controller.instance_variable_get(:@project).should be_nil
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user