lib/validatable_class_methods.rb in validatable-1.6.4 vs lib/validatable_class_methods.rb in validatable-1.6.6
- old
+ new
@@ -32,11 +32,13 @@
def before_validations
@before_validations ||= []
end
def all_validations
- return validations + self.superclass.all_validations if self.superclass.respond_to? :all_validations
+ if self.respond_to?(:superclass) && self.superclass.respond_to?(:all_validations)
+ return validations + self.superclass.all_validations
+ end
validations
end
def validations
@validations ||= []
@@ -46,9 +48,13 @@
instance.errors.add(attribute, msg)
end
def validation_keys_include?(key)
validations.map { |validation| validation.key }.include?(key)
+ end
+
+ def validations_to_include
+ @validations_to_include ||= []
end
protected
def add_validations(args, klass)
\ No newline at end of file