Explicitly return on load_resource if resource is already loaded #818

wants to merge 1 commit into from

2 participants


Hi Ryan,

I've been experiencing some problems using :through. Let's say I have a ressource Thread, which belongs to Forum. In ThreadsController I could then have

load_and_authorize_resource :through => :forum

It seems that the the :through will not respect an already loaded instance variable. If I have

before_filter :manually_set_thread # Which initailizes @thread
load_and_authorize_resource :through => :forum

the load_resource-part will run into problems, because of this part !current_ability.has_block?(authorization_action, resource_class).

Wouldn't it work if load_resource simply does nothing if @thread is already present?


Thanks for your submission! The ryanb/cancan repository has been inactive since Sep 06, 2013.
Since only Ryan himself has commit permissions, the CanCan project is on a standstill.

CanCan has many open issues, including missing support for Rails 4. To keep CanCan alive, an active fork exists at cancancommunity/cancancan. The new gem is cancancan. More info is available at #994.

If your pull request or issue is still applicable, it would be really appreciated if you resubmit it to CanCanCan.

We hope to see you on the other side!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment