Created
October 26, 2011 05:16
-
-
Save dnagir/1315515 to your computer and use it in GitHub Desktop.
CanCan optional load_and_authorize_resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostsController < InheritedResources::Base | |
belongs_to :blog, :optional => true # The controller can be nested (/blog/1/posts) or flat (/posts) | |
# How do make load_and_authorize_resource accept optional :blog? | |
load_and_authorize_resource :blog | |
load_and_authorize_resource :post, :through => :blog | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment