lib/protector/adapters/sequel/dataset.rb in protector-0.3.3 vs lib/protector/adapters/sequel/dataset.rb in protector-0.4.0

- old
+ new

@@ -30,11 +30,15 @@ alias_method_chain :each, :protector end # Gets {Protector::DSL::Meta::Box} of this dataset def protector_meta - model.protector_meta.evaluate(model, protector_subject) + model.protector_meta.evaluate( + Protector::Adapters::Sequel, + model, + protector_subject + ) end # Substitutes `row_proc` with {Protector} and injects protection scope def each_with_protector(*args, &block) return each_without_protector(*args, &block) unless protector_subject? @@ -51,10 +55,14 @@ return relation unless @opts[:eager_graph] @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(model, subject) + meta = model.protector_meta.evaluate( + Protector::Adapters::Sequel, + model, + subject + ) relation = relation.instance_eval(&meta.scope_proc) if meta.scoped? end relation \ No newline at end of file