Class: Marty::ImportType::ImportTypeValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Marty::ImportType::ImportTypeValidator
- Defined in:
- app/models/marty/import_type.rb
Instance Method Summary collapse
Instance Method Details
#validate(entry) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/models/marty/import_type.rb', line 3 def validate(entry) klass = entry.get_model_class unless klass.is_a?(Class) && klass < ActiveRecord::Base entry.errors.add :base, "bad model name" return end [ entry.cleaner_function, entry.validation_function, entry.preprocess_function, ].each { |func| entry.errors.add(:base, "unknown class method #{func}") if func && !klass.respond_to?(func.to_sym) } end |