lib/protector/adapters/sequel/dataset.rb in protector-0.5.5 vs lib/protector/adapters/sequel/dataset.rb in protector-0.6.0.beta.1
- old
+ new
@@ -38,11 +38,11 @@
# Substitutes `row_proc` with {Protector} and injects protection scope
def each_with_protector(*args, &block)
return each_without_protector(*args, &block) unless protector_subject?
relation = protector_defend_graph(clone, protector_subject)
- relation = relation.instance_eval(&protector_meta.scope_proc) if protector_meta.scoped?
+ relation = protector_meta.eval_scope_procs(relation) if protector_meta.scoped?
relation.row_proc = Restrictor.new(protector_subject, relation.row_proc)
relation.each_without_protector(*args, &block)
end
@@ -53,10 +53,10 @@
@opts[:eager_graph][:reflections].each do |association, reflection|
model = reflection[:cache][:class] if reflection[:cache].is_a?(Hash) && reflection[:cache][:class]
model = reflection[:class_name].constantize unless model
meta = model.protector_meta.evaluate(subject)
- relation = relation.instance_eval(&meta.scope_proc) if meta.scoped?
+ relation = meta.eval_scope_procs(relation) if meta.scoped?
end
relation
end
end
\ No newline at end of file