Sha256: 15237a02784e2e76133a982cbf10bdb8204517c47d0fea251fae5c97d3e567da
Contents?: true
Size: 827 Bytes
Versions: 1
Compression:
Stored size: 827 Bytes
Contents
module Heimdallr # A security-aware proxy for +ActiveRecord+ scopes. This class validates all the # method calls and either forwards them to the encapsulated scope or raises # an exception. class Proxy::Collection # Create a collection proxy. # @param context security context # @param object proxified scope def initialize(context, scope) @context, @scope = context, scope @restrictions = @object.class.restrictions(context) end # Collections cannot be restricted twice. # # @raise [RuntimeError] def restrict(context) raise RuntimeError, "Collections cannot be restricted twice" end # Dummy method_missing. # @todo Write some actual dispatching logic. def method_missing(method, *args, &block) @scope.send method, *args end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heimdallr-0.0.2 | lib/heimdallr/proxy/collection.rb |