lib/schematic/generator/column.rb in schematic-0.4.3 vs lib/schematic/generator/column.rb in schematic-0.4.4

- old
+ new

@@ -34,14 +34,18 @@ def minimum_occurrences_for_column return "1" if @required_methods.include?(@column.name.to_sym) @klass._validators[@column.name.to_sym].each do |column_validation| next unless column_validation.is_a? ActiveModel::Validations::PresenceValidator - return "1" if column_validation.options[:allow_blank] != true && column_validation.options[:if].nil? + if column_validation.options[:allow_blank] != true && + column_validation.options[:if].nil? && + column_validation.options[:unless].nil? + + return "1" + end end "0" end - def map_type(column) Types::COMPLEX[column.type][:complex_type] end