lib/protector/adapters/sequel/dataset.rb in protector-0.5.2 vs lib/protector/adapters/sequel/dataset.rb in protector-0.5.3
- old
+ new
@@ -30,15 +30,11 @@
alias_method_chain :each, :protector
end
# Gets {Protector::DSL::Meta::Box} of this dataset
def protector_meta(subject=protector_subject)
- model.protector_meta.evaluate(
- Protector::Adapters::Sequel,
- model,
- subject
- )
+ model.protector_meta.evaluate(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?
@@ -55,14 +51,10 @@
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(
- Protector::Adapters::Sequel,
- model,
- subject
- )
+ meta = model.protector_meta.evaluate(subject)
relation = relation.instance_eval(&meta.scope_proc) if meta.scoped?
end
relation
\ No newline at end of file