Skip to content


Just add singleton to description of authorize_resource #587

merged 1 commit into from

3 participants


Inside controller I don't use load_resource and just write authorize_resource. But this controller declared as resource in routing file and I was a bit confused when I was trying to understand why a nil comes to can rule in abilities. And it was because I had missed :singleton => true for authorize_resource.


[verified] This is a documentation only update.

@ryanb ryanb merged commit 78e1a17 into ryanb:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2012
  1. Just add singleton to description of authorize_resource

    Dmitriy Vorotilin committed
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/cancan/controller_additions.rb
3  lib/cancan/controller_additions.rb
@@ -151,6 +151,9 @@ def load_resource(*args)
# [:+except+]
# Does not apply before filter to given actions.
+ # [:+singleton+]
+ # Pass +true+ if this is a singleton resource through a +has_one+ association.
+ #
# [:+parent+]
# True or false depending on if the resource is considered a parent resource. This defaults to +true+ if a resource
# name is given which does not match the controller.
Something went wrong with that request. Please try again.