Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

subject and action not available #366

Closed
fedegl opened this Issue · 2 comments

2 participants

@fedegl

I have a orders controller and Iam authorizing with

load_and_authorize_resource :through => :current_account

When AccessDenied is raised the subject and action methods on the exception object are nil

  rescue_from CanCan::AccessDenied do |exception|
    Rails.logger.debug { "Exception: #{exception.inspect}, #{exception.subject.inspect}, #{exception.action.inspect}" }

    if exception.subject == Order
      redirect_to cart_items_path(:sign_in => true)
    else
      redirect_to root_url, :alert => exception.message
    end
  end

This is the output in the Rails log

Exception: #<CanCan::AccessDenied: You are not authorized to access this page.>, nil, nil
@ryanb
Owner

Looks like this is happening on this line. I'll update this so it adds the subject/action. Thanks for reporting.

@fedegl

No worries and thank you for the great gem and quick response!

@ryanb ryanb closed this in 843fe89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.