lib/valle/hooks.rb in valle-0.2.0 vs lib/valle/hooks.rb in valle-0.2.1
- old
+ new
@@ -20,10 +20,10 @@
class << self
def inherited_with_valle_validators(subclass)
inherited_without_valle_validators(subclass)
if (Valle.can_process_model?(subclass.model_name) &&
self == ActiveRecord::Base &&
- subclass != ActiveRecord::SchemaMigration)
+ (defined?(ActiveRecord::SchemaMigration) && subclass != ActiveRecord::SchemaMigration)) # skip AR::SchemaMigration (AR >= 4.X)
Valle::Hooks.extend_ar_validations_valid_method(subclass)
end
end
alias_method_chain :inherited, :valle_validators