lib/permissive/has_permissions.rb in permissive-0.2.1.alpha vs lib/permissive/has_permissions.rb in permissive-0.2.2.alpha
- old
+ new
@@ -83,14 +83,15 @@
permission_definition = Permissive::PermissionDefinition.define(self, options, &block)
permission_setter = options[:on].nil? || options[:on] == :global ? 'permissions=' : "#{options[:on].to_s.singularize}_permissions="
class_eval <<-eoc
def #{permission_setter}(values)
+ values ||= []
if values.all? {|value| value.is_a?(String) || value.is_a?(Symbol)}
can!(values, :reset => true, :on => #{options[:on].inspect})
else
- super
+ super(values)
end
end
eoc
@@ -123,10 +124,10 @@
class_eval <<-end_eval
def #{method}(scope = nil)
revoke(#{[permissions, args].flatten.join(', ').inspect}, :on => scope)
end
end_eval
- return can!(*[permissions, options].flatten)
+ return revoke(*[permissions, options].flatten)
elsif setter
class_eval <<-end_eval
def #{method}(scope = nil)
can!(#{[permissions, args].flatten.join(', ').inspect}, :on => scope)
end