Class: WipeOut::Validators::RelationsPlans

Inherits:
Base
  • Object
show all
Defined in:
lib/wipe_out/validators/relations_plans.rb

Instance Method Summary collapse

Instance Method Details

#callObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wipe_out/validators/relations_plans.rb', line 4

def call
  return if ignored?

  plan.relations.each do |name, plan|
    relation = relation_reflection(name)
    if relation
      plan.plans.each do |potential_plan|
        WipeOut::Validate.call(potential_plan, relation.klass, config, result: result)
      end
    else
      result.add_error("#{ar_class.name} has invalid relation: :#{name}")
    end
  end
end