lib/surrounded/access_control.rb in surrounded-0.7.0 vs lib/surrounded/access_control.rb in surrounded-0.7.1
- old
+ new
@@ -1,9 +1,10 @@
module Surrounded
module AccessControl
def self.extended(base)
base.send(:include, AccessMethods)
+ base.const_set(:'AccessError', Class.new(StandardError))
end
private
def disallow(*names, &block)
@@ -18,10 +19,10 @@
begin
apply_roles if __apply_role_policy == :trigger
method_restrictor = "disallow_#{name}?"
if self.respond_to?(method_restrictor, true) && self.send(method_restrictor)
- raise ::Surrounded::Context::AccessError.new("access to `#{name}' is not allowed")
+ raise ::Surrounded::Context::AccessError.new("access to #{self.name}##{name} is not allowed")
end
self.send("__trigger_#{name}")
ensure
\ No newline at end of file