lib/can_play/ability.rb in can_play-0.2.3 vs lib/can_play/ability.rb in can_play-0.2.4
- old
+ new
@@ -2,12 +2,15 @@
include CanCan::Ability
attr_accessor :user
def initialize(user)
self.user = user||CanPlay::Config.user_class_name.constantize.new
+ CanPlay::Config.super_roles.each do |role_name|
+ can(:manage, :all) if user.role?(role_name)
+ end
CanPlay::Config.role_class_name.constantize.all.each do |role|
next unless user.role?(role.name)
- role.send(CanPlay::Config.role_resources_middle_class_name.underscore.pluralize).each do |role_resource|
+ role.send(CanPlay::Config.role_resources_relation_name).each do |role_resource|
resource = CanPlay.find_by_name(role_resource.resource_name)
next unless resource
if resource[:type] == 'collection'
if resource[:behavior]
block = resource[:behavior]
\ No newline at end of file