lib/valle/hooks.rb in valle-0.2.2 vs lib/valle/hooks.rb in valle-0.2.3

- old
+ new

@@ -45,13 +45,15 @@ # @param [ActiveRecord::Base] subclass the AR::Base child class # @param [ActiveRecord::Base] inherited_from_class the AR::Base parent class # @note ActiveRecord::Validations should be defined at this point # def can_add_validators?(subclass, inherited_from_class) + # skip AR::SchemaMigration (AR >= 4.X) + return false if (defined?(ActiveRecord::SchemaMigration) && subclass == ActiveRecord::SchemaMigration) + Valle.can_process_model?(subclass.model_name) && inherited_from_class == ActiveRecord::Base && - subclass.table_exists? && - (defined?(ActiveRecord::SchemaMigration) && subclass != ActiveRecord::SchemaMigration) # skip AR::SchemaMigration (AR >= 4.X) + subclass.table_exists? end end end end