Sha256: 4aebe0b7883008b5fc5276eb578cf85714e1092f2b51ae595c2c548341991362
Contents?: true
Size: 665 Bytes
Versions: 13
Compression:
Stored size: 665 Bytes
Contents
# ActiveRecord is a little brain fuck. # We can not call instance_eval on ActiveRecord::Relation class # because it will automatically convert it to an array because #instance_eval # is not included in the method list that do not cause force result loading # That is why we need thi helper class class Datagrid::Filters::FilterEval def initialize(filter, scope, value) @filter = filter @scope = scope @value = value end def run instance_exec @value, &(@filter.block) end def method_missing(meth, *args, &blk) if @scope.respond_to?(meth) @scope.send(meth, *args, &blk) else super(meth, *args, &blk) end end end
Version data entries
13 entries across 13 versions & 1 rubygems