Class: ResponseValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/models/chimpaction.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/models/chimpaction.rb', line 4

def validate(record)
  # k =  Kernel.const_get(Chimpactions::registered_class.name.to_s.capitalize).new
   k = Chimpactions.registered_class
  if k.respond_to?(record.action) != true
    record.errors[:action] << "- '#{record.action}' is not a method of #{k.class.name} !"
  end
  if k.respond_to?(record.whenn) != true
    record.errors[:whenn] << "- '#{record.whenn}' is not a method of #{k.class.name} !"
  end
end