Skip to content

Instantly share code, notes, and snippets.

@kelsin
Created August 10, 2011 16:54
Show Gist options
  • Save kelsin/1137396 to your computer and use it in GitHub Desktop.
Save kelsin/1137396 to your computer and use it in GitHub Desktop.
CanCan rules in engines and main apps
# This is your main app/models/ability.rb file in your app
class Ability < Namespace::Ability
def initialize(user)
super
# Main app CanCan rules
end
end
# This is in your engine under app/models/namespace/ability.rb
module Namespace
class Ability
include CanCan::Ability
def initialize(user)
# Engine CanCan rules
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment