lib/can_play/ability.rb in can_play-0.1.6 vs lib/can_play/ability.rb in can_play-0.1.7
- old
+ new
@@ -5,10 +5,10 @@
def initialize(user)
self.user = user||CanPlay::Config.user_class_name.constantize.new
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|
- resource = CanPlay::Config.resource_class_name.constantize.find_by_name(role_resource.resource_name)
+ resource = CanPlay.find_by_name(role_resource.resource_name)
next unless resource
if resource[:type] == 'collection'
if resource[:behavior]
block = resource[:behavior]
can(resource[:verb], resource[:object]) if block.call(user)
\ No newline at end of file