Skip to content


Singleton resource not loading 1.6 #310

spoptchev opened this Issue · 3 comments

2 participants


I have a nested resource controller called (e.g.) books with the following cancan code:

load_and_authorize_resource :user
load_and_authorize_resource :book, :through => :user, :singleton => true

class User < AR
  has_one :book

I just switched from 1.5 to 1.6 and the @book instance variable is not set. Instead it loads all books into the @books instance variable. If I switch back to 1.5 it works as expected. Are there any code changes I'm not aware of?


I made a change to load the @books collection when params[:id] isn't present, I think this is what is causing the problem. I'll look into a solution. Thanks for reporting this.


fixing instance loading with :singleton option - closed by 7688025

@ryanb ryanb closed this

I just released 1.6.2 with this fix in it.

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.